org.jikesrvm.compilers.opt.util
Interface Graph

All Known Implementing Classes:
AnnotatedLSTGraph, CoalesceGraph, ControlFlowGraph, DepGraph, DF_Graph, LSTGraph, SpaceEffGraph

public interface Graph

An abstract interface for generic graphs; general graph utilities should be defined in terms of this interface and all graph implementations in the system should implement it.

See Also:
GraphNode, GraphEdge, GraphUtilities

Method Summary
 void addGraphEdge(GraphNode source, GraphNode target)
          Add a new edge to a graph.
 void addGraphNode(GraphNode node)
          Add a new graph node to the graph.
 void compactNodeNumbering()
          After this method is called, all nodes in the graph should have a compact numbering from 0 to (number of nodes in graph - 1).
 Enumeration<GraphNode> enumerateNodes()
          This method lists all of the nodes in a given graph.
 int numberOfNodes()
          Find out how many nodes are in the graph
 

Method Detail

enumerateNodes

Enumeration<GraphNode> enumerateNodes()
This method lists all of the nodes in a given graph. This is defined in terms of generic GraphNodes.

Returns:
an enumeration of all nodes in the graph
See Also:
GraphNode

numberOfNodes

int numberOfNodes()
Find out how many nodes are in the graph

Returns:
the number of nodes in the graph

compactNodeNumbering

void compactNodeNumbering()
After this method is called, all nodes in the graph should have a compact numbering from 0 to (number of nodes in graph - 1). This number is what should be returned by GraphNode.getIndex. This method is used by clients that want to e.g. allocate look-aside storage for graph nodes in an array.


addGraphNode

void addGraphNode(GraphNode node)
Add a new graph node to the graph.

Parameters:
node - the node to add to the graph

addGraphEdge

void addGraphEdge(GraphNode source,
                  GraphNode target)
Add a new edge to a graph. This method is deliberately defined in terms of nodes to avoid requiring graphs that implement Graph have explicit edge objects.

Parameters:
source - the source node of the edge to add
target - the target node of the edge to add