Package org.geotools.graph.path
Class Cycle
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<Node>
,Collection<Node>
,List<Node>
,RandomAccess
,NodeSequence
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.
- Author:
- Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
- See Also:
-
Field Summary
Fields inherited from class AbstractList
modCount
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionInternal method for building the edge set of the walk.boolean
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
Methods inherited from class AbstractCollection
containsAll, toString
Methods inherited from interface Collection
parallelStream, stream, toArray
Methods inherited from interface List
containsAll
Methods inherited from interface NodeSequence
iterator, size
-
Constructor Details
-
Cycle
-
-
Method Details
-
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 interfaceNodeSequence
- Overrides:
isValid
in classWalk
- Returns:
- True if valid, otherwise false.
-
buildEdges
Description copied from class:Walk
Internal method for building the edge set of the walk. This method calculated the edges upon every call.- Overrides:
buildEdges
in classWalk
- Returns:
- The list of edges for the walk, or null if the edge set could not be calculated due to an invalid walk.
-