Package dev.nm.graph.algorithm.traversal
Class BottomUp<V>
- java.lang.Object
-
- dev.nm.graph.algorithm.traversal.BottomUp<V>
-
- Type Parameters:
V
- vertex type
- All Implemented Interfaces:
GraphTraversal<V>
public class BottomUp<V> extends Object implements GraphTraversal<V>
This implementation traverses a directed acyclic graph starting from the leaves at the bottom, and reaches the roots.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface dev.nm.graph.algorithm.traversal.GraphTraversal
GraphTraversal.Node<V>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<? extends GraphTraversal.Node<V>>
getOrderedNodes()
Gets the list of visited nodes, in the order of being visited.List<? extends GraphTraversal.Node<V>>
getOrderedNodes(Collection<V> leaves)
Gets the list of visited nodes, in the order of being visited.
-
-
-
Method Detail
-
getOrderedNodes
public List<? extends GraphTraversal.Node<V>> getOrderedNodes(Collection<V> leaves)
Gets the list of visited nodes, in the order of being visited.- Parameters:
leaves
- the leave nodes, ordered by their anticipated visiting order- Returns:
- the list of visited nodes
-
getOrderedNodes
public List<? extends GraphTraversal.Node<V>> getOrderedNodes()
Description copied from interface:GraphTraversal
Gets the list of visited nodes, in the order of being visited.- Specified by:
getOrderedNodes
in interfaceGraphTraversal<V>
- Returns:
- the list of visited nodes
-
-