Package cdc.graphs.impl
Class ExtensionSubGraph<N,E>
- java.lang.Object
-
- cdc.graphs.impl.GraphFilter<N,E>
-
- cdc.graphs.impl.ExplicitSubGraph<N,E>
-
- cdc.graphs.impl.ExtensionSubGraph<N,E>
-
- Type Parameters:
N- Node classE- 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 Summary
Fields Modifier and Type Field Description (package private) HashSet<E>edgesSet of edges.-
Fields inherited from class cdc.graphs.impl.GraphFilter
delegate
-
-
Constructor Summary
Constructors Constructor Description ExtensionSubGraph(GraphAdapter<N,E> delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEdge(E edge)Add an edge and the associated nodes to the subgraph.voidaddNode(N node)Add a node to the subgraph.voidclear()Make the subgraph empty.booleancontainsEdge(E edge)booleancontainsNode(N node)Iterable<E>getEdges()Iterable<? extends E>getEdges(N node, EdgeDirection direction)Iterable<N>getNodes()NgetTip(E edge, EdgeTip tip)booleanisEmpty()Return whether the subgraph is empty or not.voidremoveEdge(E edge)Remove one edge.voidremoveEdges(N source, N target)Remove all edges between a source and a target node.voidremoveNode(N node)Remove one node and the associated edges.StringtoString()-
Methods inherited from class cdc.graphs.impl.GraphFilter
checkEdgeValidity, checkNodeValidity, getDelegate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods 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
-
-
-
-
Constructor Detail
-
ExtensionSubGraph
public ExtensionSubGraph(GraphAdapter<N,E> delegate)
-
-
Method Detail
-
clear
public final void clear()
Description copied from class:ExplicitSubGraphMake the subgraph empty.- Specified by:
clearin classExplicitSubGraph<N,E>
-
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
public final void addNode(N node)
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
public final void removeNode(N node)
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
public final void addEdge(E edge)
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
public final void removeEdge(E edge)
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
public final void removeEdges(N source, N target)
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.
-
containsNode
public final boolean containsNode(N node)
-
containsEdge
public final boolean containsEdge(E edge)
-
getEdges
public final Iterable<? extends E> getEdges(N node, EdgeDirection direction)
-
-