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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidadd a node to this graphbooleancontainsNode(T n) protected StringedgeString(T from, T to) protected abstract EdgeManager<T> protected abstract NodeManager<T> intintReturn the number ofimmediate predecessornodes of ngetPredNodes(T n) Return anIteratorover the immediate predecessor nodes of nintReturn the number ofimmediate successornodes of this Node in the GraphgetSuccNodes(T n) Return an Iterator over the immediate successor nodes of nbooleaniterator()protected StringnodeString(T n, boolean forEdge) voidremoveAllIncidentEdges(T node) voidremoveEdge(T src, T dst) voidremoveIncomingEdges(T node) voidremoveNode(T n) remove a node from this graphvoidremove a node and all its incident edgesvoidremoveOutgoingEdges(T node) stream()toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface 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:
getNumberOfNodesin interfaceNodeManager<T>- Returns:
- the number of nodes in this graph
-
getPredNodeCount
Description copied from interface:EdgeManagerReturn the number ofimmediate predecessornodes of n- Specified by:
getPredNodeCountin interfaceEdgeManager<T>- Returns:
- the number of immediate predecessors of n.
- Throws:
IllegalArgumentException
-
getPredNodes
Description copied from interface:EdgeManagerReturn anIteratorover the immediate predecessor nodes of nThis method never returns
null.- Specified by:
getPredNodesin interfaceEdgeManager<T>- Returns:
- an
Iteratorover the immediate predecessor nodes of this Node. - Throws:
IllegalArgumentException
-
getSuccNodeCount
Description copied from interface:EdgeManagerReturn the number ofimmediate successornodes of this Node in the Graph- Specified by:
getSuccNodeCountin interfaceEdgeManager<T>- Returns:
- the number of immediate successor Nodes of this Node in the Graph.
- Throws:
IllegalArgumentException
-
getSuccNodes
Description copied from interface:EdgeManagerReturn an Iterator over the immediate successor nodes of nThis method never returns
null.- Specified by:
getSuccNodesin interfaceEdgeManager<T>- Returns:
- an Iterator over the immediate successor nodes of n
- Throws:
IllegalArgumentException
-
addNode
Description copied from interface:NodeManageradd a node to this graph- Specified by:
addNodein interfaceNodeManager<T>
-
addEdge
- Specified by:
addEdgein interfaceEdgeManager<T>- Throws:
IllegalArgumentException
-
removeEdge
- Specified by:
removeEdgein interfaceEdgeManager<T>- Throws:
IllegalArgumentException
-
hasEdge
- Specified by:
hasEdgein interfaceEdgeManager<T>
-
removeAllIncidentEdges
- Specified by:
removeAllIncidentEdgesin interfaceEdgeManager<T>- Throws:
IllegalArgumentException
-
removeIncomingEdges
- Specified by:
removeIncomingEdgesin interfaceEdgeManager<T>- Throws:
IllegalArgumentException- See Also:
-
removeOutgoingEdges
- Specified by:
removeOutgoingEdgesin interfaceEdgeManager<T>- Throws:
IllegalArgumentException- See Also:
-
removeNodeAndEdges
Description copied from interface:Graphremove a node and all its incident edges- Specified by:
removeNodeAndEdgesin interfaceGraph<T>- Throws:
IllegalArgumentException- See Also:
-
removeNode
Description copied from interface:NodeManagerremove a node from this graph- Specified by:
removeNodein interfaceNodeManager<T>- Throws:
IllegalArgumentException
-
nodeString
-
edgeString
-
toString
-
containsNode
- Specified by:
containsNodein interfaceNodeManager<T>- Returns:
- true iff the graph contains the specified node
-