Class SparseDiGraph<V,​E extends Arc<V>>

  • Type Parameters:
    V - vertex type
    E - edge type
    All Implemented Interfaces:
    DiGraph<V,​E>, Graph<V,​E>
    Direct Known Subclasses:
    SparseDAGraph

    public class SparseDiGraph<V,​E extends Arc<V>>
    extends SparseGraph<V,​E>
    implements DiGraph<V,​E>
    This class implements the sparse directed graph representation.
    • Constructor Detail

      • SparseDiGraph

        public SparseDiGraph()
        Construct an empty graph.
      • SparseDiGraph

        public SparseDiGraph​(DiGraph<V,​E> g)
        (Copy) construct a graph from another graph.
        Parameters:
        g - a graph
    • Method Detail

      • outgoingArcs

        public Set<E> outgoingArcs​(V v)
        Description copied from interface: DiGraph
        Gets the set of all outgoing arcs associated with a vertex in this graph.
        Specified by:
        outgoingArcs in interface DiGraph<V,​E extends Arc<V>>
        Parameters:
        v - a vertex
        Returns:
        all outgoing arcs associated with a vertex
      • incomingArcs

        public Set<E> incomingArcs​(V v)
        Description copied from interface: DiGraph
        Gets the set of all incoming arcs associated with a vertex in this graph.
        Specified by:
        incomingArcs in interface DiGraph<V,​E extends Arc<V>>
        Parameters:
        v - a vertex
        Returns:
        all incoming arcs associated with a vertex
      • parents

        public Set<V> parents​(V v)
        Description copied from interface: DiGraph
        Gets the set of all parents of this vertex.
        Specified by:
        parents in interface DiGraph<V,​E extends Arc<V>>
        Parameters:
        v - a vertex
        Returns:
        the set of all parents
      • children

        public Set<V> children​(V v)
        Description copied from interface: DiGraph
        Gets the set of all children of this vertex.
        Specified by:
        children in interface DiGraph<V,​E extends Arc<V>>
        Parameters:
        v - a vertex
        Returns:
        the set of all children
      • vertices

        public SortedSet<V> vertices()
        Gets the set of all vertices in this graph, sorted by the number of parents. A root has no parents.
        Specified by:
        vertices in interface Graph<V,​E extends Arc<V>>
        Overrides:
        vertices in class SparseGraph<V,​E extends Arc<V>>
        Returns:
        all vertices in this graph