Documentation of 'org.jgrapht.alg.cycle.HierholzerEulerianCycle' Java class
HierholzerEulerianCycle
org.jgrapht.alg.cycle

Class HierholzerEulerianCycle<V,E>

  • Type Parameters:
    V - the graph vertex type
    E - the graph edge type
    All Implemented Interfaces:
    EulerianCycleAlgorithm<V,E>


    public class HierholzerEulerianCycle<V,E>
    extends java.lang.Object
    implements EulerianCycleAlgorithm<V,E>
    An implementation of Hierholzer's algorithm for finding an Eulerian cycle in Eulerian graphs. The algorithm works with directed and undirected graphs which may contain loops and/or multiple edges. The running time is linear, i.e. O(|E|) where |E| is the cardinality of the edge set of the graph.

    See the Wikipedia article for details and references about Eulerian cycles and a short description of Hierholzer's algorithm for the construction of an Eulerian cycle. The original presentation of the algorithm dates back to 1873 and the following paper: Carl Hierholzer: Über die Möglichkeit, einen Linienzug ohne Wiederholung und ohne Unterbrechung zu umfahren. Mathematische Annalen 6(1), 30–32, 1873.

    Since:
    October 2016
    • Constructor Detail

      • HierholzerEulerianCycle

        public HierholzerEulerianCycle()
    • Method Detail

      • isEulerian

        public boolean isEulerian(Graph<V,E> graph)
        Test whether a graph is Eulerian. An Eulerian graph is a graph containing an Eulerian cycle.
        Parameters:
        graph - the input graph
        Returns:
        true if the graph is Eulerian, false otherwise
      • getEulerianCycle

        public GraphPath<V,E> getEulerianCycle(Graph<V,E> g)
        Compute an Eulerian cycle of a graph.
        Specified by:
        getEulerianCycle in interface EulerianCycleAlgorithm<V,E>
        Parameters:
        g - the input graph
        Returns:
        an Eulerian cycle
        Throws:
        java.lang.IllegalArgumentException - in case the graph is not Eulerian

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.