Class HierarchyLayoutAlgorithm

  • All Implemented Interfaces:
    LayoutAlgorithm, LayoutConstants

    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.

    The Algorithm uses the JUNG library.
    See Also:
    JUNG Framework (Java Universal Network/Graph Framework)
    • Constructor Detail

      • HierarchyLayoutAlgorithm

        public HierarchyLayoutAlgorithm()
    • Method Detail

      • updateLayout

        public void updateLayout​(Graph graph)
        Updates the current layout by extracting the containers graph and then perform a (x,y) tranformation of all vertices.
        Specified by:
        updateLayout in interface LayoutAlgorithm
        Specified by:
        updateLayout in class AbstractLayoutAlgorithm
        Parameters:
        graph - The container of the current graph. Contains all relevant information to perform the transformation of the Graph by changing its Layout