Package org.jgrapht.alg.drawing
Class RandomLayoutAlgorithm2D<V,E>
- java.lang.Object
-
- org.jgrapht.alg.drawing.RandomLayoutAlgorithm2D<V,E>
-
- Type Parameters:
V
- the vertex typeE
- the edge type
- All Implemented Interfaces:
LayoutAlgorithm2D<V,E>
public class RandomLayoutAlgorithm2D<V,E> extends Object
Random layout. The algorithm assigns vertex coordinates uniformly at random.- Author:
- Dimitrios Michail
-
-
Field Summary
Fields Modifier and Type Field Description protected Function<V,Point2D>
initializer
A model initializer
-
Constructor Summary
Constructors Constructor Description RandomLayoutAlgorithm2D()
Create a new layout algorithmRandomLayoutAlgorithm2D(long seed)
Create a new layout algorithmRandomLayoutAlgorithm2D(Random rng)
Create a new layout algorithm
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Function<V,Point2D>
getInitializer()
Get the initializerprotected void
init(Graph<V,E> graph, LayoutModel2D<V> model)
Initialize a model using the initializer.void
layout(Graph<V,E> graph, LayoutModel2D<V> model)
Layout a graph.void
setInitializer(Function<V,Point2D> initializer)
Set the initializer
-
-
-
Constructor Detail
-
RandomLayoutAlgorithm2D
public RandomLayoutAlgorithm2D()
Create a new layout algorithm
-
RandomLayoutAlgorithm2D
public RandomLayoutAlgorithm2D(long seed)
Create a new layout algorithm- Parameters:
seed
- seed for the random number generator
-
RandomLayoutAlgorithm2D
public RandomLayoutAlgorithm2D(Random rng)
Create a new layout algorithm- Parameters:
rng
- the random number generator
-
-
Method Detail
-
layout
public void layout(Graph<V,E> graph, LayoutModel2D<V> model)
Description copied from interface:LayoutAlgorithm2D
Layout a graph.- Parameters:
graph
- the graphmodel
- the layout model to use
-
getInitializer
public Function<V,Point2D> getInitializer()
Get the initializer- Returns:
- the initializer
-
setInitializer
public void setInitializer(Function<V,Point2D> initializer)
Set the initializer- Parameters:
initializer
- the initializer
-
init
protected void init(Graph<V,E> graph, LayoutModel2D<V> model)
Initialize a model using the initializer.- Parameters:
graph
- the graphmodel
- the model
-
-