public class KKLayout extends IterableLayout
Modifier and Type | Field and Description |
---|---|
protected double |
diameter
The diameter of the visible graph.
|
protected double |
energy |
protected double |
energyDelta |
protected static java.lang.String |
LAYOUT_INDEX_KEY |
double |
THRESHOLD |
protected UnweightedShortestPath |
unweightedShortestPaths
Stores graph distances between vertices of the visible graph
|
protected java.util.Set |
vertices |
currentLayout, returnableLayout
Modifier and Type | Method and Description |
---|---|
void |
adjustForGravity(java.util.Set vertices)
Shift all vertices so that the center of gravity is located at the
center of the screen.
|
void |
calculate()
Transforms currentLayout according to current layout algorithm.
|
boolean |
getAdjustForGravity()
Returns true if gravity point adjusting is enabled.
|
protected double |
getDistance(Vertex v1,
Vertex v2)
Gets a distance (a length of the shortest path) between the specified
vertices.
|
boolean |
getExchangeVertices()
Returns true if the local minimum escape technique by exchanging
vertices is enabled.
|
void |
initializeLocationsFromLayout(EmittedLayout sla)
Starts up this layout based on a previous layout.
|
boolean |
isFinite()
Says whether this algorthms' iterations will ever end.
|
boolean |
iterationsAreDone()
Gives the outlining algorithm a sense of how long to run.
|
void |
setAdjustForGravity(boolean on)
Enable or disable gravity point adjusting.
|
void |
setExchangeVertices(boolean on)
Enable or disable the local minimum escape technique by exchanging
vertices.
|
advance, emit, getScreenSize, getVisEdge, getVisVertex
protected UnweightedShortestPath unweightedShortestPaths
protected double diameter
protected static final java.lang.String LAYOUT_INDEX_KEY
protected java.util.Set vertices
protected double energy
protected double energyDelta
public final double THRESHOLD
public void initializeLocationsFromLayout(EmittedLayout sla)
IterableLayout
initializeLocationsFromLayout
in class IterableLayout
protected double getDistance(Vertex v1, Vertex v2)
The original Kamada-Kawai algorithm requires a connected graph. That is, pathes must be exist between every pair of vertices in the graph. To visualize a non-connected graph, this method returns (diameter + 1) for vertices that are not connected.
The default implementation is as follows:
int dist = unweightedShortestPaths.getShortestPath(v1, v2); if (dist < 0) return diameter + 1; else return dist;
public void calculate()
IterableLayout
calculate
in class IterableLayout
public void adjustForGravity(java.util.Set vertices)
public void setAdjustForGravity(boolean on)
public boolean getAdjustForGravity()
public void setExchangeVertices(boolean on)
public boolean getExchangeVertices()
public boolean iterationsAreDone()
IterableLayout
iterationsAreDone
in class IterableLayout
IterableLayout.iterationsAreDone()
public boolean isFinite()
IterableLayout
isFinite
in class IterableLayout
IterableLayout.isFinite()