Class Cycle

  • All Implemented Interfaces:
    Serializable, Cloneable, Iterable<Node>, Collection<Node>, List<Node>, RandomAccess, NodeSequence

    public class Cycle
    extends Walk
    Represents a cycle in a graph. A cycle C is defined as a closed walk of size n in which nodes 1 through n-1 form a path.
    Justin Deoliveira, Refractions Research Inc,
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class AbstractList

    • Constructor Summary

      Constructor Description
      Cycle​(Collection<Node> nodes)  
    • Constructor Detail

      • Cycle

        public Cycle​(Collection<Node> nodes)
    • Method Detail

      • isValid

        public boolean isValid()
        Tests if the cycle is valid. A valid cycle satisfies two conditions:

        1. Each pair of adjacent nodes share an edge.
        2. The first and last nodes share an edge. 3. The only node repetition is the first and last nodes.
        Specified by:
        isValid in interface NodeSequence
        isValid in class Walk
        True if valid, otherwise false.
      • buildEdges

        protected List<Edge> buildEdges()
        Description copied from class: Walk
        Internal method for building the edge set of the walk. This method calculated the edges upon every call.
        buildEdges in class Walk
        The list of edges for the walk, or null if the edge set could not be calculated due to an invalid walk.