|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsamples.preview_new_graphdraw.iter.IterableLayout
samples.preview_new_graphdraw.iterablelayouts.KKLayout
public class KKLayout
Implements the Kamada-Kawai algorithm for node layout. Does not respect filter calls, and sometimes crashes when the view changes to it.
Field Summary | |
---|---|
protected double |
diameter
The diameter of the visible graph. |
protected double |
energy
|
protected double |
energyDelta
|
protected static String |
LAYOUT_INDEX_KEY
|
double |
THRESHOLD
|
protected UnweightedShortestPath |
unweightedShortestPaths
Stores graph distances between vertices of the visible graph |
protected Set |
vertices
|
Fields inherited from class samples.preview_new_graphdraw.iter.IterableLayout |
---|
currentLayout, returnableLayout |
Constructor Summary | |
---|---|
KKLayout()
|
|
KKLayout(double thresh)
|
Method Summary | |
---|---|
void |
adjustForGravity(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. |
Methods inherited from class samples.preview_new_graphdraw.iter.IterableLayout |
---|
advance, emit, getScreenSize, getVisEdge, getVisVertex |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected UnweightedShortestPath unweightedShortestPaths
protected double diameter
protected static final String LAYOUT_INDEX_KEY
protected Set vertices
protected double energy
protected double energyDelta
public final double THRESHOLD
Constructor Detail |
---|
public KKLayout()
public KKLayout(double thresh)
Method Detail |
---|
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(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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |