|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchord.util.graph.AbstractGraph<Node>
Node - The type of the graph's nodes.public abstract class AbstractGraph<Node>
Partial implementation of a directed graph that provides various operations on the graph that are useful for program analysis (e.g., computing SCCs, ordering nodes in RPO, etc.) but leaves the representation of the graph itself unspecified.
This class must be extended by clients who wish to use the various operations provided by it but want to provide their own representation of the graph.
This class must be used regardless of whether the desired kind of directed graph is mutable or immutable, and labeled or unlabeled. The appropriate interface must be used to convey these characteristics, namely:
IGraph for the immutable, unlabeled case, ILabeledGraph for the immutable, labeled case, IMutableGraph for the mutable, unlabeled case, and IMutableLabeledGraph for the mutable, labeled case
| Field Summary | |
|---|---|
protected boolean |
cached
|
| Constructor Summary | |
|---|---|
AbstractGraph()
|
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object o)
|
protected void |
evictCache()
|
AllPathsBuilder<Node> |
getAllPathsBuilder(Node srcNode,
IPathVisitor<Node> visitor,
int maxPathWidth,
int maxPathDepth)
|
java.util.Set<Pair<Node,Node>> |
getBackEdges()
Provides all back edges in a depth-first traversal of the graph reachable from the root nodes. |
IndexMap<Node> |
getNodeMap()
Provides a map from each node in this graph to a unique arbitrary integer in the range [0..N] where N is the total number of nodes in the graph. |
java.util.Set<Node> |
getNodesInCycles()
Provides all nodes of the graph reachable from the root nodes that are contained in cycles. |
java.util.List<Node> |
getNodesInRPO()
Provides all nodes in the graph reachable from the root nodes, ordered in Reverse Post Order (RPO). |
ShortestPathBuilder<Node> |
getShortestPathsBuilder(Node srcNode,
IPathVisitor<Node> visitor)
|
void |
getSimpleCycles(IGraphEntityVisitor<Node> visitor)
Computes all simple cycles of this graph. |
java.util.List<java.util.Set<Node>> |
getTopSortedSCCs()
Provides the list of Strongly Connected Components (SCCs) of the graph reachable from its root nodes, sorted in topological order. |
boolean |
hasCycles()
Determines whether the graph reachable from the root nodes contains any cycles. |
int |
hashCode()
|
boolean |
isConnected()
Determines whether each node in the graph is reachable from some root node. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface chord.util.graph.IGraph |
|---|
getNodes, getPreds, getRoots, getSuccs, hasEdge, hasNode, hasRoot, numNodes, numPreds, numRoots, numSuccs |
| Field Detail |
|---|
protected boolean cached
| Constructor Detail |
|---|
public AbstractGraph()
| Method Detail |
|---|
protected void evictCache()
public boolean isConnected()
IGraph
isConnected in interface IGraph<Node>public java.util.List<Node> getNodesInRPO()
IGraph
getNodesInRPO in interface IGraph<Node>public java.util.List<java.util.Set<Node>> getTopSortedSCCs()
IGraph
getTopSortedSCCs in interface IGraph<Node>public java.util.Set<Pair<Node,Node>> getBackEdges()
IGraph
getBackEdges in interface IGraph<Node>public boolean hasCycles()
IGraph
hasCycles in interface IGraph<Node>public java.util.Set<Node> getNodesInCycles()
IGraph
getNodesInCycles in interface IGraph<Node>public void getSimpleCycles(IGraphEntityVisitor<Node> visitor)
IGraph
getSimpleCycles in interface IGraph<Node>visitor - A visitor over the graph's simple cycles.
public ShortestPathBuilder<Node> getShortestPathsBuilder(Node srcNode,
IPathVisitor<Node> visitor)
getShortestPathsBuilder in interface IGraph<Node>
public AllPathsBuilder<Node> getAllPathsBuilder(Node srcNode,
IPathVisitor<Node> visitor,
int maxPathWidth,
int maxPathDepth)
getAllPathsBuilder in interface IGraph<Node>public IndexMap<Node> getNodeMap()
IGraph
getNodeMap in interface IGraph<Node>public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||