Class KKLayout<V,E>
java.lang.Object
edu.uci.ics.jung.algorithms.layout.AbstractLayout<V,E>
edu.uci.ics.jung.algorithms.layout.KKLayout<V,E>
- All Implemented Interfaces:
com.google.common.base.Function<V,
,Point2D> Layout<V,
,E> IterativeContext
,Function<V,
Point2D>
Implements the Kamada-Kawai algorithm for node layout.
Does not respect filter calls, and sometimes crashes when the view changes to it.
- Author:
- Masanori Harada
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected double
The diameter of the visible graph.Retrieves graph distances between vertices of the visible graphFields inherited from class edu.uci.ics.jung.algorithms.layout.AbstractLayout
graph, initialized, locations, size
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Shift all vertices so that the center of gravity is located at the center of the screen.boolean
done()
boolean
boolean
void
Initializes fields in the node that may not have been set during the constructor.boolean
void
reset()
void
setAdjustForGravity
(boolean on) void
setDisconnectedDistanceMultiplier
(double disconnected_multiplier) void
setExchangeVertices
(boolean on) Enable or disable the local minimum escape technique by exchanging vertices.void
setLengthFactor
(double length_factor) void
setMaxIterations
(int maxIterations) void
When a visualization is resized, it presumably wants to fix the locations of the vertices and possibly to reinitialize its data.void
step()
Advances one step.Methods inherited from class edu.uci.ics.jung.algorithms.layout.AbstractLayout
apply, getGraph, getSize, getX, getY, isLocked, lock, lock, offsetVertex, setGraph, setInitializer, setLocation, setLocation
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.google.common.base.Function
equals
-
Field Details
-
distance
Retrieves graph distances between vertices of the visible graph -
diameter
protected double diameterThe diameter of the visible graph. In other words, the maximum over all pairs of vertices of the length of the shortest path between a and bf the visible graph.
-
-
Constructor Details
-
KKLayout
-
KKLayout
Creates an instance for the specified graph and distance metric.- Parameters:
g
- the graph on which the layout algorithm is to operatedistance
- specifies the distance between pairs of vertices
-
-
Method Details
-
setLengthFactor
public void setLengthFactor(double length_factor) - Parameters:
length_factor
- a multiplicative factor which partially specifies the preferred length of an edge
-
setDisconnectedDistanceMultiplier
public void setDisconnectedDistanceMultiplier(double disconnected_multiplier) - Parameters:
disconnected_multiplier
- a multiplicative factor that specifies the fraction of the graph's diameter to be used as the inter-vertex distance between disconnected vertices
-
getStatus
- Returns:
- a string with information about the current status of the algorithm.
-
setMaxIterations
public void setMaxIterations(int maxIterations) -
isIncremental
public boolean isIncremental()- Returns:
- true
-
done
public boolean done()- Specified by:
done
in interfaceIterativeContext
- Returns:
- true if the current iteration has passed the maximum count.
-
initialize
public void initialize()Description copied from interface:Layout
Initializes fields in the node that may not have been set during the constructor. Must be called before the iterations begin.- Specified by:
initialize
in interfaceLayout<V,
E>
-
step
public void step()Description copied from interface:IterativeContext
Advances one step.- Specified by:
step
in interfaceIterativeContext
-
adjustForGravity
public void adjustForGravity()Shift all vertices so that the center of gravity is located at the center of the screen. -
setSize
Description copied from class:AbstractLayout
When a visualization is resized, it presumably wants to fix the locations of the vertices and possibly to reinitialize its data. The current method calls initializeLocations followed by initialize_local. -
setAdjustForGravity
public void setAdjustForGravity(boolean on) -
getAdjustForGravity
public boolean getAdjustForGravity() -
setExchangeVertices
public void setExchangeVertices(boolean on) Enable or disable the local minimum escape technique by exchanging vertices.- Parameters:
on
- iff the local minimum escape technique is to be enabled
-
getExchangeVertices
public boolean getExchangeVertices() -
reset
public void reset()
-