Package org.graph4j.traversal
Class BFSTraverser
java.lang.Object
org.graph4j.traversal.BFSTraverser
A breadth first search (BFS) 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 TypeMethodDescriptionbooleanintmaxLevel()intvoidtraverse(int start) voidtraverse(int start, BFSVisitor visitor) voidtraverse(BFSVisitor visitor)
-
Constructor Details
-
BFSTraverser
- Parameters:
graph- the graph to be traversed.
-
-
Method Details
-
traverse
- Parameters:
visitor- a visitor of the traversal.
-
traverse
public void traverse(int start) - Parameters:
start- the start vertex number.
-
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.
-
maxLevel
public int maxLevel()- Returns:
- the maximum level in the search tree, root is at level 0.
-
isInterrupted
public boolean isInterrupted()- Returns:
trueif the traversal was interrupted before all vertices have been visited.
-