Package org.graph4j.traversal
Class DFSTraverser
java.lang.Object
org.graph4j.traversal.DFSTraverser
A depth first search (DFS) traverser of the graph. As the graph is traversed,
a visitor methods are invoked corresponding with the current operation.
- Author:
- Cristian Frăsinaru
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanintvoidtraverse(int start, DFSVisitor visitor) voidtraverse(DFSVisitor visitor)
-
Constructor Details
-
DFSTraverser
- Parameters:
graph- the graph to be traversed.
-
-
Method Details
-
traverse
- Parameters:
visitor- a visitor of the traversal.
-
traverse
- Parameters:
start- the start vertex number.visitor- a visitor of the traversal.
-
numComponents
public int numComponents()- Returns:
- the number of connected components identified by the traversal.
-
isInterrupted
public boolean isInterrupted()- Returns:
trueif the traversal was interrupted before all vertices have been visited.
-