public class KKLayoutInt extends AbstractLayout
| Modifier and Type | Field and Description |
|---|---|
protected int |
diameter
The diameter of the visible graph.
|
protected UnweightedShortestPath |
unweightedShortestPaths
Stores graph distances between vertices of the visible graph
|
changeSupport, vertex_locations| Constructor and Description |
|---|
KKLayoutInt(Graph g) |
| Modifier and Type | Method and Description |
|---|---|
void |
adjustForGravity()
Shift all vertices so that the center of gravity is located at
the center of the screen.
|
void |
advancePositions()
Implementors must override this method in order to create a Layout.
|
boolean |
getAdjustForGravity()
Returns true if gravity point adjusting is enabled.
|
protected int |
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.
|
java.lang.String |
getStatus()
Returns the current status of the sytem, or null if there
is no particular status to report.
|
boolean |
incrementsAreDone()
Returns true once the current iteration has passed the maximum count.
|
protected void |
initialize_local_vertex(Vertex v)
Initializes the local information on a single vertex.
|
protected void |
initialize_local()
Initializes all local information, and is called immediately within the
initialize() process.
|
protected void |
initializeLocations()
This method calls initialize_local_vertex for each vertex,
and also adds initial coordinate information for each vertex.
|
boolean |
isIncremental()
This one is an incremental visualization.
|
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.
|
void |
setMaxIterations(int maxIterations) |
addChangeListener, applyFilter, dontMove, fireStateChanged, forceMove, getAVertex, getBaseKey, getChangeListeners, getCoordinates, getCurrentSize, getEdge, getEdge, getGraph, getLocation, getVertex, getVertex, getVertexIterator, getVisibleEdges, getVisibleGraph, getVisibleVertices, getX, getY, initialize, initialize, initializeLocation, isLocked, lockVertex, offsetVertex, postInitialize, removeChangeListener, resize, restart, unlockVertexprotected UnweightedShortestPath unweightedShortestPaths
protected int diameter
public KKLayoutInt(Graph g)
public java.lang.String getStatus()
AbstractLayoutgetStatus in interface LayoutgetStatus in class AbstractLayoutpublic void setMaxIterations(int maxIterations)
public boolean isIncremental()
public boolean incrementsAreDone()
protected void initialize_local()
AbstractLayoutinitialize_local in class AbstractLayoutprotected void initializeLocations()
AbstractLayoutinitializeLocations in class AbstractLayoutprotected int 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;
protected void initialize_local_vertex(Vertex v)
AbstractLayoutinitialize_local_vertex in class AbstractLayoutpublic void advancePositions()
AbstractLayoutNote that "locked" vertices are not to be moved; however, it is the policy of the visualization to decide how to handle them, and what to do with the vertices around them. Prototypical code might include a clipping like
for (Iterator i = getVertices().iterator(); i.hasNext() ) { Vertex v = (Vertex) i.next(); if (! dontmove.contains( v ) ) { ... // handle the node } else { // ignore the node } }
advancePositions in interface LayoutadvancePositions in class AbstractLayoutLayout.advancePositions()public void adjustForGravity()
public void setAdjustForGravity(boolean on)
public boolean getAdjustForGravity()
public void setExchangeVertices(boolean on)
public boolean getExchangeVertices()