Class AbstractGraph<T>
java.lang.Object
com.ibm.wala.util.graph.AbstractGraph<T>
- All Implemented Interfaces:
EdgeManager<T>
,Graph<T>
,NodeManager<T>
,Iterable<T>
- Direct Known Subclasses:
AbstractLabeledGraph
,AbstractNumberedGraph
,BasicGraph
,InvertedGraph
,SelfLoopAddedGraph
Basic functionality for a
Graph
that delegates node and edge management.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
add a node to this graphboolean
containsNode
(@Nullable T n) protected String
edgeString
(T from, T to) protected abstract EdgeManager
<T> protected abstract NodeManager
<T> int
int
Return the number ofimmediate predecessor
nodes of ngetPredNodes
(@Nullable T n) Return anIterator
over the immediate predecessor nodes of nint
Return the number ofimmediate successor
nodes of this Node in the GraphgetSuccNodes
(@Nullable T n) Return an Iterator over the immediate successor nodes of nboolean
iterator()
protected String
nodeString
(T n, boolean forEdge) void
removeAllIncidentEdges
(T node) void
removeEdge
(T src, T dst) void
removeIncomingEdges
(T node) void
removeNode
(T n) remove a node from this graphvoid
remove a node and all its incident edgesvoid
removeOutgoingEdges
(T node) stream()
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
AbstractGraph
public AbstractGraph()
-
-
Method Details
-
getNodeManager
- Returns:
- the object which manages nodes in the graph
-
getEdgeManager
- Returns:
- the object which manages edges in the graph
-
stream
-
iterator
-
getNumberOfNodes
public int getNumberOfNodes()- Specified by:
getNumberOfNodes
in interfaceNodeManager<T>
- Returns:
- the number of nodes in this graph
- See Also:
-
getPredNodeCount
Description copied from interface:EdgeManager
Return the number ofimmediate predecessor
nodes of n- Specified by:
getPredNodeCount
in interfaceEdgeManager<T>
- Returns:
- the number of immediate predecessors of n.
- Throws:
IllegalArgumentException
- See Also:
-
getPredNodes
Description copied from interface:EdgeManager
Return anIterator
over the immediate predecessor nodes of nThis method never returns
null
.- Specified by:
getPredNodes
in interfaceEdgeManager<T>
- Returns:
- an
Iterator
over the immediate predecessor nodes of this Node. - Throws:
IllegalArgumentException
- See Also:
-
getSuccNodeCount
Description copied from interface:EdgeManager
Return the number ofimmediate successor
nodes of this Node in the Graph- Specified by:
getSuccNodeCount
in interfaceEdgeManager<T>
- Returns:
- the number of immediate successor Nodes of this Node in the Graph.
- Throws:
IllegalArgumentException
- See Also:
-
getSuccNodes
Description copied from interface:EdgeManager
Return an Iterator over the immediate successor nodes of nThis method never returns
null
.- Specified by:
getSuccNodes
in interfaceEdgeManager<T>
- Returns:
- an Iterator over the immediate successor nodes of n
- Throws:
IllegalArgumentException
- See Also:
-
addNode
Description copied from interface:NodeManager
add a node to this graph- Specified by:
addNode
in interfaceNodeManager<T>
- See Also:
-
addEdge
- Specified by:
addEdge
in interfaceEdgeManager<T>
- Throws:
IllegalArgumentException
- See Also:
-
removeEdge
- Specified by:
removeEdge
in interfaceEdgeManager<T>
- Throws:
IllegalArgumentException
- See Also:
-
hasEdge
- Specified by:
hasEdge
in interfaceEdgeManager<T>
- See Also:
-
removeAllIncidentEdges
- Specified by:
removeAllIncidentEdges
in interfaceEdgeManager<T>
- Throws:
IllegalArgumentException
- See Also:
-
removeIncomingEdges
- Specified by:
removeIncomingEdges
in interfaceEdgeManager<T>
- Throws:
IllegalArgumentException
- See Also:
-
removeOutgoingEdges
- Specified by:
removeOutgoingEdges
in interfaceEdgeManager<T>
- Throws:
IllegalArgumentException
- See Also:
-
removeNodeAndEdges
Description copied from interface:Graph
remove a node and all its incident edges- Specified by:
removeNodeAndEdges
in interfaceGraph<T>
- Throws:
IllegalArgumentException
- See Also:
-
removeNode
Description copied from interface:NodeManager
remove a node from this graph- Specified by:
removeNode
in interfaceNodeManager<T>
- Throws:
IllegalArgumentException
- See Also:
-
nodeString
-
edgeString
-
toString
-
containsNode
- Specified by:
containsNode
in interfaceNodeManager<T>
- Returns:
- true iff the graph contains the specified node
- See Also:
-