V
 the graph vertex typeE
 the graph edge typepublic class CycleDetector<V,E> extends Object
Constructor and Description 

CycleDetector(Graph<V,E> graph)
Creates a cycle detector for the specified graph.

Modifier and Type  Method and Description 

boolean 
detectCycles()
Performs yes/no cycle detection on the entire graph.

boolean 
detectCyclesContainingVertex(V v)
Performs yes/no cycle detection on an individual vertex.

Set<V> 
findCycles()
Finds the vertex set for the subgraph of all cycles.

Set<V> 
findCyclesContainingVertex(V v)
Finds the vertex set for the subgraph of all cycles which contain a particular vertex.

public boolean detectCycles()
public boolean detectCyclesContainingVertex(V v)
v
 the vertex to testpublic Set<V> findCycles()
public Set<V> findCyclesContainingVertex(V v)
REVIEW jvs 25Aug2006: This implementation is not guaranteed to cover all cases. If you want to be absolutely certain that you report vertices from all cycles containing v, it's safer (but less efficient) to use StrongConnectivityAlgorithm instead and return the strongly connected component containing v.
v
 the vertex to testCopyright © 2017. All rights reserved.