Class ExtensionSubGraph<N,​E>

  • Type Parameters:
    N - Node class
    E - Edge class
    All Implemented Interfaces:
    GraphAdapter<N,​E>

    public class ExtensionSubGraph<N,​E>
    extends ExplicitSubGraph<N,​E>
    Explicit subgraph defined by extension.

    At creation time the subgraph is empty. Nodes and edges are then added and removed again.
    Nodes and edges of a subgraph should belong to delegate. This is checked when possible, but if delegate changes, this is not guaranteed.

    Author:
    Damien Carbonne
    • Field Detail

      • edges

        final HashSet<E> edges
        Set of edges. They must also belong to delegate.
    • Constructor Detail

      • ExtensionSubGraph

        public ExtensionSubGraph​(GraphAdapter<N,​E> delegate)
    • Method Detail

      • isEmpty

        public final boolean isEmpty()
        Description copied from class: ExplicitSubGraph
        Return whether the subgraph is empty or not.
        Specified by:
        isEmpty in class ExplicitSubGraph<N,​E>
        Returns:
        whether the subgraph is empty or not.
      • addNode

        public final void addNode​(N node)
        Description copied from class: ExplicitSubGraph
        Add a node to the subgraph.
        Specified by:
        addNode in class ExplicitSubGraph<N,​E>
        Parameters:
        node - The node to add. Must belong to delegate.
      • removeNode

        public final void removeNode​(N node)
        Description copied from class: ExplicitSubGraph
        Remove one node and the associated edges. If node does not belong to subgraph, does nothing.
        Specified by:
        removeNode in class ExplicitSubGraph<N,​E>
        Parameters:
        node - The node to remove.
      • addEdge

        public final void addEdge​(E edge)
        Description copied from class: ExplicitSubGraph
        Add an edge and the associated nodes to the subgraph.
        Specified by:
        addEdge in class ExplicitSubGraph<N,​E>
        Parameters:
        edge - The edge to add. Must belong to delegate.
      • removeEdge

        public final void removeEdge​(E edge)
        Description copied from class: ExplicitSubGraph
        Remove one edge. If edge does not belong to subgraph, does nothing.
        Specified by:
        removeEdge in class ExplicitSubGraph<N,​E>
        Parameters:
        edge - The edge to remove.
      • removeEdges

        public final void removeEdges​(N source,
                                      N target)
        Description copied from class: ExplicitSubGraph
        Remove all edges between a source and a target node. If source or edge does not belong to subgraph, does nothing.
        Specified by:
        removeEdges in class ExplicitSubGraph<N,​E>
        Parameters:
        source - The source node.
        target - The target node.
      • getNodes

        public final Iterable<N> getNodes()
      • containsNode

        public final boolean containsNode​(N node)
      • getEdges

        public final Iterable<E> getEdges()
      • containsEdge

        public final boolean containsEdge​(E edge)
      • getTip

        public final N getTip​(E edge,
                              EdgeTip tip)