public class CycleDetector extends Object implements GraphWalker
BreadthFirstTopologicalIterator
Constructor and Description |
---|
CycleDetector(Graph graph)
Constructs a new CycleDetector.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsCycle()
Performs the iteration to determine if a cycle exits in the graph.
|
protected GraphIterator |
createIterator()
Creates the iterator to be used in the cycle detection.
|
void |
finish()
Does nothing.
|
int |
visit(Graphable element,
GraphTraversal traversal)
Increments the count of nodes visited.
|
public CycleDetector(Graph graph)
graph
- The graph to be tested for cycle existance.public boolean containsCycle()
public int visit(Graphable element, GraphTraversal traversal)
visit
in interface GraphWalker
element
- The component being visited.traversal
- The traversal controlling the sequence of graph component visits.GraphWalker.visit(Graphable, GraphTraversal)
public void finish()
finish
in interface GraphWalker
GraphWalker.finish()
protected GraphIterator createIterator()
Copyright © 1996–2023 Geotools. All rights reserved.