- All Implemented Interfaces:
public class Cycle extends WalkRepresents 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, email@example.com
- See Also:
- Serialized Form
All Methods Instance Methods Concrete Methods Modifier and Type Method Description
buildEdges()Internal method for building the edge set of the walk.
isValid()Tests if the cycle is valid.
Methods inherited from class Walk
add, add, addAll, addAll, addEdge, addEdges, duplicate, equals, equals, getEdges, getFirst, getLast, hashCode, isClosed, remove, remove, remove, removeAll, reverse, riterator, truncate
Methods inherited from class ArrayList
clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
public Cycle(Collection<Node> nodes)
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.
protected List<Edge> buildEdges()Description copied from class:
WalkInternal method for building the edge set of the walk. This method calculated the edges upon every call.