Class FRLayout2<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.algorithms.layout.AbstractLayout<V,E>
-
- edu.uci.ics.jung.algorithms.layout.FRLayout2<V,E>
-
- All Implemented Interfaces:
Layout<V,E>
,IterativeContext
,org.apache.commons.collections4.Transformer<V,java.awt.geom.Point2D>
public class FRLayout2<V,E> extends AbstractLayout<V,E> implements IterativeContext
Implements the Fruchterman-Reingold force-directed algorithm for node layout. This is an experimental attempt at optimizingFRLayout
; if it is successful it will be folded back intoFRLayout
(and this class will disappear).Behavior is determined by the following settable parameters:
-
attraction multiplier: how much edges try to keep their vertices together
repulsion multiplier: how much vertices try to push each other apart
maximum iterations: how many iterations this algorithm will use before stopping
- See Also:
- "Fruchterman and Reingold, 'Graph Drawing by Force-directed Placement'"
-
-
Field Summary
-
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 protected void
calcAttraction(E e)
protected void
calcPositions(V v)
protected void
calcRepulsion(V v1)
boolean
done()
Returns true once the current iteration has passed the maximum count, MAX_ITERATIONS.void
initialize()
Initializes fields in the node that may not have been set during the constructor.boolean
isIncremental()
This one is an incremental visualization.void
reset()
void
setAttractionMultiplier(double attraction)
Sets the attraction multiplier.void
setMaxIterations(int maxIterations)
Sets the maximum number of iterations.void
setRepulsionMultiplier(double repulsion)
Sets the repulsion multiplier.void
setSize(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.void
step()
Moves the iteration forward one notch, calculation attraction and repulsion between vertices and edges and cooling the temperature.-
Methods inherited from class edu.uci.ics.jung.algorithms.layout.AbstractLayout
getGraph, getSize, getX, getY, isLocked, lock, lock, offsetVertex, setGraph, setInitializer, setLocation, setLocation, transform
-
-
-
-
Method Detail
-
setSize
public void setSize(java.awt.Dimension size)
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.
-
setAttractionMultiplier
public void setAttractionMultiplier(double attraction)
Sets the attraction multiplier.
-
setRepulsionMultiplier
public void setRepulsionMultiplier(double repulsion)
Sets the repulsion multiplier.
-
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()
Moves the iteration forward one notch, calculation attraction and repulsion between vertices and edges and cooling the temperature.- Specified by:
step
in interfaceIterativeContext
-
calcPositions
protected void calcPositions(V v)
-
calcAttraction
protected void calcAttraction(E e)
-
calcRepulsion
protected void calcRepulsion(V v1)
-
setMaxIterations
public void setMaxIterations(int maxIterations)
Sets the maximum number of iterations.
-
isIncremental
public boolean isIncremental()
This one is an incremental visualization.
-
done
public boolean done()
Returns true once the current iteration has passed the maximum count, MAX_ITERATIONS.- Specified by:
done
in interfaceIterativeContext
-
-