public class HierarchyLayoutAlgorithm extends AbstractLayoutAlgorithm
Algorithm to transform a graph of vertices and edges into a hierarchical structure of a 2D plane. It is a geometric transformation which does not change the graph but the x and y position of its vertices.
The algorithm generates the layout correctly if only one root element exists or if there are no vertices at all If no root element exists, a random vertex from the graph is picked and defined as root. If multiple root elements exist, a parent of those is created and called dummy root element. This ensures that there is only one root element.
The current graph to be transformed is extracted from the GraphContainer
.
Basically all its vertices are transformed and then the new layout is set back to the GraphContainer by executing
the updateLayout
method.
ELBOW_ROOM, LAYOUT_HEIGHT, LAYOUT_WIDTH, SPRING_FORCE_MULTIPLIER, SPRING_LAYOUT_REPULSION
Constructor and Description |
---|
HierarchyLayoutAlgorithm() |
Modifier and Type | Method and Description |
---|---|
void |
updateLayout(Graph graph)
Updates the current layout by extracting the containers graph and then perform a (x,y) tranformation
of all vertices.
|
initializer, initializer, selectLayoutSize
public void updateLayout(Graph graph)
updateLayout
in interface LayoutAlgorithm
updateLayout
in class AbstractLayoutAlgorithm
graph
- The container of the current graph. Contains all relevant information to perform the transformation
of the Graph
by changing its Layout
Copyright © 2018. All rights reserved.