- java.lang.Object
-
- org.jgrapht.alg.drawing.BaseLayoutAlgorithm2D<V,E>
-
- org.jgrapht.alg.drawing.FRLayoutAlgorithm2D<V,E>
-
- org.jgrapht.alg.drawing.IndexedFRLayoutAlgorithm2D<V,E>
-
- Type Parameters:
V
- the graph vertex typeE
- the graph edge type
- All Implemented Interfaces:
LayoutAlgorithm2D<V,E>
public class IndexedFRLayoutAlgorithm2D<V,E> extends FRLayoutAlgorithm2D<V,E>
Fruchterman and Reingold Force-Directed Placement Algorithm using the Barnes-Hut indexing technique with a QuadTree. The Barnes-Hut indexing technique is described in the following paper:- J. Barnes and P. Hut. A hierarchical O(N log N) force-calculation algorithm. Nature. 324(4):446--449, 1986.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jgrapht.alg.drawing.FRLayoutAlgorithm2D
FRLayoutAlgorithm2D.InverseLinearTemperatureModel, FRLayoutAlgorithm2D.TemperatureModel
-
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_THETA_FACTOR
Default $\theta$ value for approximation using the Barnes-Hut techniqueprotected long
savedComparisons
protected double
theta
-
Fields inherited from class org.jgrapht.alg.drawing.FRLayoutAlgorithm2D
comparator, DEFAULT_ITERATIONS, DEFAULT_NORMALIZATION_FACTOR, iterations, normalizationFactor, optimalDistance, rng, temperatureModelSupplier
-
Fields inherited from class org.jgrapht.alg.drawing.BaseLayoutAlgorithm2D
initializer
-
-
Constructor Summary
Constructors Constructor Description IndexedFRLayoutAlgorithm2D()
Create a new layout algorithmIndexedFRLayoutAlgorithm2D(int iterations, double theta)
Create a new layout algorithmIndexedFRLayoutAlgorithm2D(int iterations, double theta, double normalizationFactor)
Create a new layout algorithmIndexedFRLayoutAlgorithm2D(int iterations, double theta, double normalizationFactor, java.util.Random rng)
Create a new layout algorithmIndexedFRLayoutAlgorithm2D(int iterations, double theta, double normalizationFactor, java.util.Random rng, double tolerance)
Create a new layout algorithm
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<V,Point2D>
calculateRepulsiveForces(Graph<V,E> graph, LayoutModel2D<V> model)
Calculate the repulsive forces between verticeslong
getSavedComparisons()
Get the total number of saved comparisons due to the Barnes-Hut technique.void
layout(Graph<V,E> graph, LayoutModel2D<V> model)
Layout a graph.-
Methods inherited from class org.jgrapht.alg.drawing.FRLayoutAlgorithm2D
attractiveForce, calculateAttractiveForces, repulsiveForce
-
Methods inherited from class org.jgrapht.alg.drawing.BaseLayoutAlgorithm2D
getInitializer, init, setInitializer
-
-
-
-
Field Detail
-
DEFAULT_THETA_FACTOR
public static final double DEFAULT_THETA_FACTOR
Default $\theta$ value for approximation using the Barnes-Hut technique- See Also:
- Constant Field Values
-
theta
protected double theta
-
savedComparisons
protected long savedComparisons
-
-
Constructor Detail
-
IndexedFRLayoutAlgorithm2D
public IndexedFRLayoutAlgorithm2D()
Create a new layout algorithm
-
IndexedFRLayoutAlgorithm2D
public IndexedFRLayoutAlgorithm2D(int iterations, double theta)
Create a new layout algorithm- Parameters:
iterations
- number of iterationstheta
- parameter for approximation using the Barnes-Hut technique
-
IndexedFRLayoutAlgorithm2D
public IndexedFRLayoutAlgorithm2D(int iterations, double theta, double normalizationFactor)
Create a new layout algorithm- Parameters:
iterations
- number of iterationstheta
- parameter for approximation using the Barnes-Hut techniquenormalizationFactor
- normalization factor for the optimal distance
-
IndexedFRLayoutAlgorithm2D
public IndexedFRLayoutAlgorithm2D(int iterations, double theta, double normalizationFactor, java.util.Random rng)
Create a new layout algorithm- Parameters:
iterations
- number of iterationstheta
- theta parameter for the Barnes-Hut approximationnormalizationFactor
- normalization factor for the optimal distancerng
- the random number generator
-
IndexedFRLayoutAlgorithm2D
public IndexedFRLayoutAlgorithm2D(int iterations, double theta, double normalizationFactor, java.util.Random rng, double tolerance)
Create a new layout algorithm- Parameters:
iterations
- number of iterationstheta
- theta parameter for the Barnes-Hut approximationnormalizationFactor
- normalization factor for the optimal distancerng
- the random number generatortolerance
- tolerance used when comparing floating point values
-
-
Method Detail
-
layout
public void layout(Graph<V,E> graph, LayoutModel2D<V> model)
Description copied from interface:LayoutAlgorithm2D
Layout a graph.- Specified by:
layout
in interfaceLayoutAlgorithm2D<V,E>
- Overrides:
layout
in classFRLayoutAlgorithm2D<V,E>
- Parameters:
graph
- the graphmodel
- the layout model to use
-
calculateRepulsiveForces
protected java.util.Map<V,Point2D> calculateRepulsiveForces(Graph<V,E> graph, LayoutModel2D<V> model)
Description copied from class:FRLayoutAlgorithm2D
Calculate the repulsive forces between vertices- Overrides:
calculateRepulsiveForces
in classFRLayoutAlgorithm2D<V,E>
- Parameters:
graph
- the graphmodel
- the model- Returns:
- the displacement per vertex due to the repulsive forces
-
getSavedComparisons
public long getSavedComparisons()
Get the total number of saved comparisons due to the Barnes-Hut technique.- Returns:
- the total number of saved comparisons
-
-