Package cdc.graphs.impl
Class RestrictionSubGraph<N,E>
java.lang.Object
cdc.graphs.impl.GraphFilter<N,E>
cdc.graphs.impl.ExplicitSubGraph<N,E>
cdc.graphs.impl.RestrictionSubGraph<N,E>
- Type Parameters:
N- Node classE- Edge class
- All Implemented Interfaces:
GraphAdapter<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 Summary
FieldsModifier and TypeFieldDescriptionSet of removed edges.Set of removed nodes.Fields inherited from class cdc.graphs.impl.GraphFilter
delegate -
Constructor Summary
ConstructorsConstructorDescriptionRestrictionSubGraph(GraphAdapter<N, E> delegate) Creates a full subgraph from a delegate. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidAdd an edge and the associated nodes to the subgraph.final voidAdd a node to the subgraph.final voidclear()Make the subgraph empty.final booleancontainsEdge(E edge) final booleancontainsNode(N node) getEdges()getEdges(N node, EdgeDirection direction) getNodes()final Nfinal booleanisEmpty()Return whether the subgraph is empty or not.final voidremoveEdge(E edge) Remove one edge.final voidremoveEdges(N source, N target) Remove all edges between a source and a target node.final voidremoveNode(N node) Remove one node and the associated edges.final voidreset()Makes the subgraph equals the underlying graph.toString()Methods inherited from class cdc.graphs.impl.GraphFilter
checkEdgeValidity, checkNodeValidity, getDelegateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface cdc.graphs.GraphAdapter
getConnectedNodes, getConnectedNodes, getConnectivity, getEdges, getEdges, getEdges, getEdges, getEdgesCount, getEdgesCount, getEdgesCount, getEdgesStream, getEdgesStream, getEdgesStream, getLeaves, getNodes, getNodesCount, getNodesStream, getRoots, hasEdge, hasEdges, hasEdges, hasEdges, hasNodes, isLeaf, isRoot
-
Field Details
-
removedNodes
Set of removed nodes. -
removedEdges
Set of removed edges.
-
-
Constructor Details
-
RestrictionSubGraph
Creates a full subgraph from a delegate.- Parameters:
delegate- The delegate.
-
-
Method Details
-
clear
public final void clear()Description copied from class:ExplicitSubGraphMake the subgraph empty.- Specified by:
clearin classExplicitSubGraph<N,E>
-
reset
public final void reset()Makes the subgraph equals the underlying graph. -
isEmpty
public final boolean isEmpty()Description copied from class:ExplicitSubGraphReturn whether the subgraph is empty or not.- Specified by:
isEmptyin classExplicitSubGraph<N,E> - Returns:
- whether the subgraph is empty or not.
-
addNode
Description copied from class:ExplicitSubGraphAdd a node to the subgraph.- Specified by:
addNodein classExplicitSubGraph<N,E> - Parameters:
node- The node to add. Must belong to delegate.
-
removeNode
Description copied from class:ExplicitSubGraphRemove one node and the associated edges. If node does not belong to subgraph, does nothing.- Specified by:
removeNodein classExplicitSubGraph<N,E> - Parameters:
node- The node to remove.
-
addEdge
Description copied from class:ExplicitSubGraphAdd an edge and the associated nodes to the subgraph.- Specified by:
addEdgein classExplicitSubGraph<N,E> - Parameters:
edge- The edge to add. Must belong to delegate.
-
removeEdge
Description copied from class:ExplicitSubGraphRemove one edge. If edge does not belong to subgraph, does nothing.- Specified by:
removeEdgein classExplicitSubGraph<N,E> - Parameters:
edge- The edge to remove.
-
removeEdges
Description copied from class:ExplicitSubGraphRemove all edges between a source and a target node. If source or edge does not belong to subgraph, does nothing.- Specified by:
removeEdgesin classExplicitSubGraph<N,E> - Parameters:
source- The source node.target- The target node.
-
getRemovedNodes
-
getRemovedEdges
-
getNodes
-
containsNode
-
getEdges
-
containsEdge
-
getEdges
-
getTip
-
toString
-