Class 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.
    • Constructor Detail

      • BottomUp

        public BottomUp​(DAGraph<V,​? extends Arc<V>> g)
        Constructs a BottomUp traversal instance.
        Parameters:
        g - a directed acyclic graph
    • 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