Class RestrictionSubGraph<N,​E>

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

    public class RestrictionSubGraph<N,​E>
    extends ExplicitSubGraph<N,​E>
    Explicit subgraph defined by restriction. At creation time the subgraph is full. Nodes and edges are then removed and can be added again.

    SubGraph built from an underlying graph. It can be constructed by removing nodes and edges from the full graph or by adding nodes and edges to an empty graph.

    Author:
    Damien Carbonne
    • Field Detail

      • removedNodes

        final Set<N> removedNodes
        Set of removed nodes.
      • removedEdges

        final Set<E> removedEdges
        Set of removed edges.
    • Constructor Detail

      • RestrictionSubGraph

        public RestrictionSubGraph​(GraphAdapter<N,​E> delegate)
        Creates a full subgraph from a delegate.
        Parameters:
        delegate - The delegate.
    • Method Detail

      • reset

        public final void reset()
        Makes the subgraph equals the underlying graph.
      • 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.
      • getRemovedNodes

        public final Set<N> getRemovedNodes()
      • getRemovedEdges

        public final Set<E> getRemovedEdges()
      • getNodes

        public final Iterable<? extends N> getNodes()
      • containsNode

        public final boolean containsNode​(N node)
      • getEdges

        public final Iterable<? extends E> getEdges()
      • containsEdge

        public final boolean containsEdge​(E edge)
      • getTip

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