soot.toolkits.graph
Interface MutableEdgeLabelledDirectedGraph

All Superinterfaces:
DirectedGraph, Iterable
All Known Subinterfaces:
ProgramDependenceGraph
All Known Implementing Classes:
HashMutableEdgeLabelledDirectedGraph, HashMutablePDG

public interface MutableEdgeLabelledDirectedGraph
extends DirectedGraph

Defines a DirectedGraph which is modifiable and associates a label object with every edge. Provides an interface to add/delete nodes and edges.


Method Summary
 void addEdge(Object from, Object to, Object label)
          Adds an edge to the graph between 2 nodes.
 void addNode(Object node)
          Adds a node to the graph.
 boolean containsAnyEdge(Object label)
           
 boolean containsAnyEdge(Object from, Object to)
           
 boolean containsEdge(Object from, Object to, Object label)
           
 boolean containsNode(Object node)
           
 MutableDirectedGraph getEdgesForLabel(Object label)
          Returns a MutableDirectedGraph consisting of all edges with the given label and their nodes.
 List<Object> getLabelsForEdges(Object from, Object to)
          Returns a list of labels for which an edge exists between from and to
 List<Object> getNodes()
           
 void removeAllEdges(Object label)
          Removes all edges with the given label in the graph.
 void removeAllEdges(Object from, Object to)
          Removes all edges between 2 nodes in the graph.
 void removeEdge(Object from, Object to, Object label)
          Removes an edge between 2 nodes in the graph.
 void removeNode(Object node)
          Removes a node from the graph.
 
Methods inherited from interface soot.toolkits.graph.DirectedGraph
getHeads, getPredsOf, getSuccsOf, getTails, iterator, size
 

Method Detail

addEdge

void addEdge(Object from,
             Object to,
             Object label)
Adds an edge to the graph between 2 nodes. If the edge is already present no change is made.

Parameters:
from - out node for the edge.
to - in node for the edge.
label - label for the edge.

getLabelsForEdges

List<Object> getLabelsForEdges(Object from,
                               Object to)
Returns a list of labels for which an edge exists between from and to

Parameters:
from - out node for the edges to remove.
to - in node for the edges to remove.

getEdgesForLabel

MutableDirectedGraph getEdgesForLabel(Object label)
Returns a MutableDirectedGraph consisting of all edges with the given label and their nodes. Nodes without edges are not included in the new graph.

Parameters:
label - label for the edge to remove.

removeEdge

void removeEdge(Object from,
                Object to,
                Object label)
Removes an edge between 2 nodes in the graph. If the edge is not present no change is made.

Parameters:
from - out node for the edges to remove.
to - in node for the edges to remove.
label - label for the edge to remove.

removeAllEdges

void removeAllEdges(Object from,
                    Object to)
Removes all edges between 2 nodes in the graph. If no edges are present, no change is made.

Parameters:
from - out node for the edges to remove.
to - in node for the edges to remove.

removeAllEdges

void removeAllEdges(Object label)
Removes all edges with the given label in the graph. If no edges are present, no change is made.

Parameters:
label - label for the edge to remove.

containsEdge

boolean containsEdge(Object from,
                     Object to,
                     Object label)
Returns:
true if the graph contains an edge between the 2 nodes with the given label, otherwise return false.

containsAnyEdge

boolean containsAnyEdge(Object from,
                        Object to)
Parameters:
from - out node for the edges.
to - in node for the edges.
Returns:
true if the graph contains any edges between the 2 nodes, otherwise return false.

containsAnyEdge

boolean containsAnyEdge(Object label)
Parameters:
label - label for the edges.
Returns:
true if the graph contains any edges with the given label, otherwise return false.

getNodes

List<Object> getNodes()
Returns:
a list of the nodes that compose the graph. No ordering is implied.

addNode

void addNode(Object node)
Adds a node to the graph. Initially the added node has no successors or predecessors. ; as a consequence it is considered both a head and tail for the graph.

Parameters:
node - a node to add to the graph.
See Also:
DirectedGraph.getHeads(), DirectedGraph.getTails()

removeNode

void removeNode(Object node)
Removes a node from the graph. If the node is not found in the graph, no change is made.

Parameters:
node - the node to be removed.

containsNode

boolean containsNode(Object node)
Parameters:
node - node that we want to know if the graph constains.
Returns:
true if the graph contains the node. false otherwise.