Package dev.nm.graph.algorithm.traversal
Class GraphTraversal.Node<V>
- java.lang.Object
-
- dev.nm.graph.algorithm.traversal.GraphTraversal.Node<V>
-
- Type Parameters:
V- vertex type
- All Implemented Interfaces:
Comparable<GraphTraversal.Node<V>>
- Direct Known Subclasses:
BFS.Node
- Enclosing interface:
- GraphTraversal<V>
public static class GraphTraversal.Node<V> extends Object implements Comparable<GraphTraversal.Node<V>>
This is a node in a spanning tree.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(GraphTraversal.Node<V> n)Vparent()Gets the parent of the node.protected voidsetParent(V parent)Sets the parent of the node.protected voidsetVisitTime(int time)StringtoString()Vvertex()Gets the node.intvisitTime()Gets the first visit time of this node.
-
-
-
Constructor Detail
-
Node
protected Node(V vertex)
Constructs a node for a spanning tree.- Parameters:
vertex- the node
-
-
Method Detail
-
setParent
protected void setParent(V parent)
Sets the parent of the node.- Parameters:
parent- the parent of the node
-
parent
public V parent()
Gets the parent of the node.- Returns:
- the parent of the node
-
vertex
public V vertex()
Gets the node.- Returns:
- the node
-
setVisitTime
protected void setVisitTime(int time)
-
visitTime
public int visitTime()
Gets the first visit time of this node.- Returns:
- the first visit time
-
compareTo
public int compareTo(GraphTraversal.Node<V> n)
- Specified by:
compareToin interfaceComparable<V>
-
-