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,java.awt.geom.Point2D>,Layout<V,E>,IterativeContext,java.util.function.Function<V,java.awt.geom.Point2D>
public class KKLayout<V,E> extends AbstractLayout<V,E> implements IterativeContext
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:
- "Tomihisa Kamada and Satoru Kawai: An algorithm for drawing general indirect graphs. Information Processing Letters 31(1):7-15, 1989", "Tomihisa Kamada: On visualization of abstract objects and relations. Ph.D. dissertation, Dept. of Information Science, Univ. of Tokyo, Dec. 1988."
-
-
Field Summary
Fields Modifier and Type Field Description protected doublediameterThe diameter of the visible graph.protected Distance<V>distanceRetrieves graph distances between vertices of the visible graph-
Fields inherited from class edu.uci.ics.jung.algorithms.layout.AbstractLayout
graph, initialized, locations, size
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadjustForGravity()Shift all vertices so that the center of gravity is located at the center of the screen.booleandone()booleangetAdjustForGravity()booleangetExchangeVertices()java.lang.StringgetStatus()voidinitialize()Initializes fields in the node that may not have been set during the constructor.booleanisIncremental()voidreset()voidsetAdjustForGravity(boolean on)voidsetDisconnectedDistanceMultiplier(double disconnected_multiplier)voidsetExchangeVertices(boolean on)Enable or disable the local minimum escape technique by exchanging vertices.voidsetLengthFactor(double length_factor)voidsetMaxIterations(int maxIterations)voidsetSize(java.awt.Dimension size)When a visualization is resized, it presumably wants to fix the locations of the vertices and possibly to reinitialize its data.voidstep()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
-
-
-
-
Field Detail
-
distance
protected Distance<V> distance
Retrieves graph distances between vertices of the visible graph
-
diameter
protected double diameter
The 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.
-
-
Method Detail
-
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
public java.lang.String 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:
donein interfaceIterativeContext- Returns:
- true if the current iteration has passed the maximum count.
-
initialize
public void initialize()
Description copied from interface:LayoutInitializes fields in the node that may not have been set during the constructor. Must be called before the iterations begin.- Specified by:
initializein interfaceLayout<V,E>
-
step
public void step()
Description copied from interface:IterativeContextAdvances one step.- Specified by:
stepin interfaceIterativeContext
-
adjustForGravity
public void adjustForGravity()
Shift all vertices so that the center of gravity is located at the center of the screen.
-
setSize
public void setSize(java.awt.Dimension size)
Description copied from class:AbstractLayoutWhen 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()
-
-