Package org.graph4j.traversal
Class SearchNode
java.lang.Object
org.graph4j.traversal.SearchNode
A node of the BFS or DFS tree created while traversing a graph. It contains a
vertex of the graph and additional information about its location in the
exploration tree.
- Author:
- Cristian Frăsinaru
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbooleaninthashCode()booleanisAncestorOf(SearchNode other) intlevel()static SearchNodeintorder()parent()toString()intvertex()
-
Constructor Details
-
SearchNode
public SearchNode(int vertex) - Parameters:
vertex- the vertex number.
-
-
Method Details
-
component
public int component()- Returns:
- the connected component number of this node, starting with 0.
-
vertex
public int vertex()- Returns:
- the vertex corresponding to this node.
-
level
public int level()- Returns:
- the level of this node in the tree.
-
order
public int order()- Returns:
- the visiting time, starting with 0.
-
parent
- Returns:
- the parent of this node, or
nullif it is root.
-
isAncestorOf
- Parameters:
other- another node of the tree.- Returns:
true, if this node is an ancestor of other.
-
nearestAncestor
- Parameters:
a- a node of the tree.b- a node of the tree- Returns:
- the neareast ancestor of a and b.
-
hashCode
public int hashCode() -
equals
-
toString
-