Class Trail

All Implemented Interfaces:
Iterable<Integer>
Direct Known Subclasses:
Circuit, Path

public class Trail extends Walk
A trail is a walk with no repeated edge. Vertices can repeat. Edges can not repeat. In order to ensure these properties are respected, call validate. A trail is closed if the last vertex equals the first one. The length of a walk is its number of edges.
Author:
Cristian Frăsinaru
See Also:
  • Constructor Details

    • Trail

      public Trail(Graph graph)
    • Trail

      public Trail(Graph graph, int initialCapacity)
    • Trail

      public Trail(Graph graph, int[] vertices)
  • Method Details

    • isValid

      public boolean isValid()
      Overrides:
      isValid in class Walk
      Returns:
      false if the vertices do not represent the intendended structure.
    • checkDuplicateEdges

      protected final void checkDuplicateEdges()