public class HashMutableEdgeLabelledDirectedGraph<N,L> extends Object implements MutableEdgeLabelledDirectedGraph<N,L>
Modifier and Type | Field and Description |
---|---|
protected Map<soot.toolkits.graph.HashMutableEdgeLabelledDirectedGraph.DGEdge<N>,List<L>> |
edgeToLabels |
protected Set<N> |
heads |
protected Map<L,List<soot.toolkits.graph.HashMutableEdgeLabelledDirectedGraph.DGEdge<N>>> |
labelToEdges |
protected Map<N,List<N>> |
nodeToPreds |
protected Map<N,List<N>> |
nodeToSuccs |
protected Set<N> |
tails |
Constructor and Description |
---|
HashMutableEdgeLabelledDirectedGraph() |
Modifier and Type | Method and Description |
---|---|
void |
addEdge(N from,
N to,
L label)
Adds an edge to the graph between 2 nodes.
|
void |
addNode(N node)
Adds a node to the graph.
|
void |
clearAll()
Removes all nodes and edges.
|
HashMutableEdgeLabelledDirectedGraph<N,L> |
clone() |
boolean |
containsAnyEdge(L label) |
boolean |
containsAnyEdge(N from,
N to) |
boolean |
containsEdge(N from,
N to,
L label) |
boolean |
containsNode(N node) |
MutableDirectedGraph<N> |
getEdgesForLabel(L label)
Returns a MutableDirectedGraph consisting of
all edges with the given label and their nodes.
|
List<N> |
getHeads()
Returns a list of entry points for this graph.
|
List<L> |
getLabelsForEdges(N from,
N to)
Returns a list of labels for which an edge exists between from and to
|
List<N> |
getNodes() |
List<N> |
getPredsOf(N s)
Returns a list of predecessors for the given node in the graph.
|
List<N> |
getSuccsOf(N s)
Returns a list of successors for the given node in the graph.
|
List<N> |
getTails()
Returns a list of exit points for this graph.
|
Iterator<N> |
iterator()
Returns an iterator for the nodes in this graph.
|
void |
printGraph() |
void |
removeAllEdges(L label)
Removes all edges with the given label in the graph.
|
void |
removeAllEdges(N from,
N to)
Removes all edges between 2 nodes in the graph.
|
void |
removeEdge(N from,
N to,
L label)
Removes an edge between 2 nodes in the graph.
|
void |
removeNode(N node)
Removes a node from the graph.
|
int |
size()
Returns the node count for this graph.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
protected Map<soot.toolkits.graph.HashMutableEdgeLabelledDirectedGraph.DGEdge<N>,List<L>> edgeToLabels
protected Map<L,List<soot.toolkits.graph.HashMutableEdgeLabelledDirectedGraph.DGEdge<N>>> labelToEdges
public HashMutableEdgeLabelledDirectedGraph()
public void clearAll()
public HashMutableEdgeLabelledDirectedGraph<N,L> clone()
public List<N> getHeads()
DirectedGraph
getHeads
in interface DirectedGraph<N>
public List<N> getTails()
DirectedGraph
getTails
in interface DirectedGraph<N>
public List<N> getPredsOf(N s)
DirectedGraph
getPredsOf
in interface DirectedGraph<N>
public List<N> getSuccsOf(N s)
DirectedGraph
getSuccsOf
in interface DirectedGraph<N>
public int size()
DirectedGraph
size
in interface DirectedGraph<N>
public Iterator<N> iterator()
DirectedGraph
public void addEdge(N from, N to, L label)
MutableEdgeLabelledDirectedGraph
addEdge
in interface MutableEdgeLabelledDirectedGraph<N,L>
from
- out node for the edge.to
- in node for the edge.label
- label for the edge.public List<L> getLabelsForEdges(N from, N to)
MutableEdgeLabelledDirectedGraph
getLabelsForEdges
in interface MutableEdgeLabelledDirectedGraph<N,L>
from
- out node for the edges to remove.to
- in node for the edges to remove.public MutableDirectedGraph<N> getEdgesForLabel(L label)
MutableEdgeLabelledDirectedGraph
getEdgesForLabel
in interface MutableEdgeLabelledDirectedGraph<N,L>
label
- label for the edge to remove.public void removeEdge(N from, N to, L label)
MutableEdgeLabelledDirectedGraph
removeEdge
in interface MutableEdgeLabelledDirectedGraph<N,L>
from
- out node for the edges to remove.to
- in node for the edges to remove.label
- label for the edge to remove.public void removeAllEdges(N from, N to)
MutableEdgeLabelledDirectedGraph
removeAllEdges
in interface MutableEdgeLabelledDirectedGraph<N,L>
from
- out node for the edges to remove.to
- in node for the edges to remove.public void removeAllEdges(L label)
MutableEdgeLabelledDirectedGraph
removeAllEdges
in interface MutableEdgeLabelledDirectedGraph<N,L>
label
- label for the edge to remove.public boolean containsEdge(N from, N to, L label)
containsEdge
in interface MutableEdgeLabelledDirectedGraph<N,L>
public boolean containsAnyEdge(N from, N to)
containsAnyEdge
in interface MutableEdgeLabelledDirectedGraph<N,L>
from
- out node for the edges.to
- in node for the edges.public boolean containsAnyEdge(L label)
containsAnyEdge
in interface MutableEdgeLabelledDirectedGraph<N,L>
label
- label for the edges.public boolean containsNode(N node)
containsNode
in interface MutableEdgeLabelledDirectedGraph<N,L>
node
- node that we want to know if the graph constains.public List<N> getNodes()
getNodes
in interface MutableEdgeLabelledDirectedGraph<N,L>
public void addNode(N node)
MutableEdgeLabelledDirectedGraph
addNode
in interface MutableEdgeLabelledDirectedGraph<N,L>
node
- a node to add to the graph.DirectedGraph.getHeads()
,
DirectedGraph.getTails()
public void removeNode(N node)
MutableEdgeLabelledDirectedGraph
removeNode
in interface MutableEdgeLabelledDirectedGraph<N,L>
node
- the node to be removed.public void printGraph()