Package org.jgrapht.alg.drawing
Class CircularLayoutAlgorithm2D<V,E>
- java.lang.Object
-
- org.jgrapht.alg.drawing.CircularLayoutAlgorithm2D<V,E>
-
- Type Parameters:
V
- the vertex typeE
- the edge type
- All Implemented Interfaces:
LayoutAlgorithm2D<V,E>
public class CircularLayoutAlgorithm2D<V,E> extends Object
Circular layout.The algorithm places the graph vertices on a circle evenly spaced. The vertices are iterated based on the iteration order of the vertex set of the graph. The order can be adjusted by providing an external comparator.
- Author:
- Dimitrios Michail
-
-
Field Summary
Fields Modifier and Type Field Description protected Comparator<Double>
comparator
protected Function<V,Point2D>
initializer
A model initializerprotected double
radius
protected Comparator<V>
vertexComparator
-
Constructor Summary
Constructors Constructor Description CircularLayoutAlgorithm2D()
Create a new layout algorithmCircularLayoutAlgorithm2D(double radius)
Create a new layout algorithmCircularLayoutAlgorithm2D(double radius, Comparator<V> vertexComparator)
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
-
-
-
Field Detail
-
radius
protected double radius
-
comparator
protected Comparator<Double> comparator
-
vertexComparator
protected Comparator<V> vertexComparator
-
-
Constructor Detail
-
CircularLayoutAlgorithm2D
public CircularLayoutAlgorithm2D()
Create a new layout algorithm
-
CircularLayoutAlgorithm2D
public CircularLayoutAlgorithm2D(double radius)
Create a new layout algorithm- Parameters:
radius
- the circle radius
-
CircularLayoutAlgorithm2D
public CircularLayoutAlgorithm2D(double radius, Comparator<V> vertexComparator)
Create a new layout algorithm. The algorithm will iterate over the vertices of the graph using the provided ordering.- Parameters:
radius
- the circle radiusvertexComparator
- the vertex comparator. Can be null.
-
-
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
-
-