Package dev.nm.graph.algorithm.traversal
Class DFS.Node<V>
- java.lang.Object
-
- dev.nm.graph.algorithm.traversal.GraphTraversal.Node<V>
-
- dev.nm.graph.algorithm.traversal.BFS.Node<V>
-
- dev.nm.graph.algorithm.traversal.DFS.Node<V>
-
- Type Parameters:
V
- vertex type
- All Implemented Interfaces:
Comparable<GraphTraversal.Node<V>>
public static class DFS.Node<V> extends BFS.Node<V>
This is a node in a DFS-spanning tree.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DFS.Node.Color
This is the coloring scheme of visits.
-
Field Summary
Fields Modifier and Type Field Description protected DFS.Node.Color
color
protected int
finishTime
protected boolean
isCyclic
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DFS.Node.Color
color()
Gets the color of this node.int
finishTime()
Gets the finish time, the time to finish visiting its sub-tree, of this node.boolean
isCyclic()
Check whether this node is on a cyclic path of the graph.String
toString()
-
Methods inherited from class dev.nm.graph.algorithm.traversal.GraphTraversal.Node
compareTo, parent, setParent, setVisitTime, vertex, visitTime
-
-
-
-
Field Detail
-
color
protected DFS.Node.Color color
-
finishTime
protected int finishTime
-
isCyclic
protected boolean isCyclic
-
-
Constructor Detail
-
Node
protected Node(V vertex)
Constructs a node for a spanning tree.- Parameters:
vertex
- the node
-
-
Method Detail
-
color
public DFS.Node.Color color()
Gets the color of this node.- Returns:
- the color
-
finishTime
public int finishTime()
Gets the finish time, the time to finish visiting its sub-tree, of this node.- Returns:
- the finish time
-
isCyclic
public boolean isCyclic()
Check whether this node is on a cyclic path of the graph.- Returns:
true
if this node is on a cyclic path of the graph
-
-