Class Graph<T>


  • public class Graph<T>
    extends Object
    Simple graph class to implement topological sort (used to sort methods based on what groups they depend on).
    Author:
    Cedric Beust, Aug 19, 2004
    • Method Detail

      • addNode

        public void addNode​(T tm)
      • getPredecessors

        public Set<T> getPredecessors​(T node)
      • isIndependent

        public boolean isIndependent​(T object)
      • addPredecessor

        public void addPredecessor​(T tm,
                                   T predecessor)
      • getNeighbors

        public Set<T> getNeighbors​(T t)
      • getIndependentNodes

        public Set<T> getIndependentNodes()
        Returns:
        All the nodes that don't have any order with each other.
      • getStrictlySortedNodes

        public List<T> getStrictlySortedNodes()
        Returns:
        All the nodes that have an order with each other, sorted in one of the valid sorts.
      • topologicalSort

        public void topologicalSort()
      • findPredecessors

        public List<T> findPredecessors​(T o)
        Parameters:
        o -
        Returns:
        A list of all the predecessors for o