Package com.ibm.wala.util.graph
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
,InvertedGraph
,SelfLoopAddedGraph
Basic functionality for a
Graph
that delegates node and edge management.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
add a node to this graphboolean
containsNode
(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
(T n) Return anIterator
over the immediate predecessor nodes of n This method never returnsnull
.int
Return the number ofimmediate successor
nodes of this Node in the GraphgetSuccNodes
(T n) Return an Iterator over the immediate successor nodes of nboolean
iterator()
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) 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
-
iterator
-
getNumberOfNodes
public int getNumberOfNodes()- Specified by:
getNumberOfNodes
in interfaceNodeManager<T>
- Returns:
- the number of nodes in this graph
-
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
-
getPredNodes
Description copied from interface:EdgeManager
Return anIterator
over the immediate predecessor nodes of n This method never returnsnull
.- Specified by:
getPredNodes
in interfaceEdgeManager<T>
- Returns:
- an
Iterator
over the immediate predecessor nodes of this Node. - Throws:
IllegalArgumentException
-
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
-
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
-
addNode
Description copied from interface:NodeManager
add a node to this graph- Specified by:
addNode
in interfaceNodeManager<T>
-
addEdge
- Specified by:
addEdge
in interfaceEdgeManager<T>
- Throws:
IllegalArgumentException
-
removeEdge
- Specified by:
removeEdge
in interfaceEdgeManager<T>
- Throws:
IllegalArgumentException
-
hasEdge
- Specified by:
hasEdge
in interfaceEdgeManager<T>
-
removeAllIncidentEdges
- Specified by:
removeAllIncidentEdges
in interfaceEdgeManager<T>
- Throws:
IllegalArgumentException
-
removeIncomingEdges
- Specified by:
removeIncomingEdges
in interfaceEdgeManager<T>
- Throws:
IllegalArgumentException
-
removeOutgoingEdges
- Specified by:
removeOutgoingEdges
in interfaceEdgeManager<T>
- Throws:
IllegalArgumentException
-
removeNodeAndEdges
Description copied from interface:Graph
remove a node and all its incident edges- Specified by:
removeNodeAndEdges
in interfaceGraph<T>
- Throws:
IllegalArgumentException
-
removeNode
Description copied from interface:NodeManager
remove a node from this graph- Specified by:
removeNode
in interfaceNodeManager<T>
- Throws:
IllegalArgumentException
-
edgeString
-
toString
-
containsNode
- Specified by:
containsNode
in interfaceNodeManager<T>
- Returns:
- true iff the graph contains the specified node
-