org._3pq.jgrapht.alg
Class CycleDetector
java.lang.Object
org._3pq.jgrapht.alg.CycleDetector
public class CycleDetector
extends java.lang.Object
Performs cycle detection on a graph. The inspected graph is specified
at construction time and cannot be modified. Currently, the detector
supports only directed graphs.
CycleDetector
public CycleDetector(DirectedGraph graph)
Creates a cycle detector for the specified graph. Currently only
directed graphs are supported.
graph
- the DirectedGraph in which to detect cycles
detectCycles
public boolean detectCycles()
Performs yes/no cycle detection on the entire graph.
- true iff the graph contains at least one cycle
detectCyclesContainingVertex
public boolean detectCyclesContainingVertex(Object v)
Performs yes/no cycle detection on an individual vertex.
- true if v is on at least one cycle
findCycles
public Set findCycles()
Finds the vertex set for the subgraph of all cycles.
- set of all vertices which participate in at least one cycle in
this graph
findCyclesContainingVertex
public Set findCyclesContainingVertex(Object v)
Finds the vertex set for the subgraph of all cycles which contain a
particular vertex.
- set of all vertices reachable from v via at least one cycle