Class DirectedGraphNode<K,​V>

    • Field Detail

      • children

        protected Set<K> children
      • parents

        protected Set<K> parents
      • topoSortOrder

        protected int topoSortOrder
    • Constructor Detail

      • DirectedGraphNode

        public DirectedGraphNode​(K key,
                                 V value,
                                 DirectedGraph<K,​V> graph)
        Parameters:
        key - Object
        value - Object
        graph - Graph
    • Method Detail

      • addChild

        public void addChild​(K newChildKey)
        Parameters:
        newChildKey - Object
      • addParent

        public void addParent​(K newParentKey)
        Parameters:
        newParentKey - Object
      • clone

        public DirectedGraphNode<K,​V> clone()
        Makes a copy of this node. It does not make a deep copy of the contents. This should be used when making subgraphs.
        Overrides:
        clone in class Object
        Returns:
        Object
      • getAllChildNodes

        public Set<DirectedGraphNode<K,​V>> getAllChildNodes()
        Get all the children of this node, recursively.
      • getAllParentNodes

        public Set<DirectedGraphNode<K,​V>> getAllParentNodes()
        Get all the parents of this node, recursively.
        Returns:
      • getChildCount

        public int getChildCount()
        Returns:
        int how many children this node has, determined recursively.
      • getChildGraph

        public DirectedGraph<K,​V> getChildGraph()
        Get the subgraph starting from this node, including this node.
        Returns:
        Graph
      • getChildKeys

        public Set<K> getChildKeys()
        Returns:
        Object
      • getChildNodes

        public Set<DirectedGraphNode<K,​V>> getChildNodes()
        Get the immediate children of this node. References to the DirectedGraphNodes are given, as opposed to key values.
        Returns:
        Set containing the child nodes of this node.
      • getParentKeys

        public Set<K> getParentKeys()
        Returns:
        Object
      • getParentNodes

        public Set<DirectedGraphNode<K,​V>> getParentNodes()
        Get the immediate parents of this node. References to the DirectedGraphNodes are given, as opposed to key values.
        Returns:
        Set
      • getTopoSortOrder

        public int getTopoSortOrder()
        Returns:
        int
      • hasChild

        public boolean hasChild​(Object j)
        Check to see if this node has a particular immediate child.
        Parameters:
        j - Object
        Returns:
        boolean
      • hasParent

        public boolean hasParent​(Object j)
        Check to see if this node has a particular immediate parent.
        Parameters:
        j - Object
        Returns:
        boolean
      • inDegree

        public int inDegree()
        Returns:
        int number of immediate parents this node has.
      • isLeaf

        public boolean isLeaf()
        Returns:
      • numParents

        public int numParents()
        Returns:
        int how many parents this node has, determined recursively.
      • outDegree

        public int outDegree()
        Returns:
        int number of immediate children this node has.
      • prune

        public void prune()
        Remove connections that are to nodes not contained in this graph
      • setTopoSortOrder

        public void setTopoSortOrder​(int i)
        Parameters:
        i - int