Method Summary |
|
public void | addEdge(GraphNode v, GraphNode w) Adds a directed edge from node v to node w. |
public void | addNode(Object key, GraphNode node) Insertes a node (and its associated key) into this Graph.
Parameters: key - A unique value associated with this node. |
public GraphNode | getNode(Object key) Returns the node in this Graph with a given key. |
public boolean | hasEdge(GraphNode v, GraphNode w) Searches this Graph for an (directed) edge between two GraphNodes.
Parameters: v - Source node of desired edge. Parameters: w - Destination node of desired edge. |
public boolean | hasNode(GraphNode v) Searchs this Graph for a given GraphNode.
Parameters: v - GraphNode to search for. |
public boolean | isAncestorToDescendent(GraphNode v, GraphNode w) Determines whether or not a node v is an ancestor (has a lower pre-order
index and a higher post-order index) of a node w.
Parameters: v - Candidate ancestor node. Parameters: w - Candidate descendent node. |
public Set | keySet() Returns a Set of the keys used to uniquely identify the nodes in this
Graph. |
public Collection | nodes() Returns all the nodes in this Graph. |
public List | postOrder() Return the nodes in this Graph ordered by their post-order index. |
public int | postOrderIndex(GraphNode node) Returns the index of a given node in a post-order ordering of this Graph. |
public List | preOrder() Returns the nodes in this Graph ordered by their pre-order index. |
public int | preOrderIndex(GraphNode node) Returns the index of a given node in a pre-order ordering of this Graph. |
public Collection | preds(GraphNode v) Returns the predacessors of a given node. |
public void | removeEdge(GraphNode v, GraphNode w) |
public void | removeNode(Object key) Removes a node with a given key from the Graph. |
public void | removeUnreachable() Removes all nodes from this Graph that cannot be reached in a pre-order
traversal of the Graph. |
public Collection | reverseRoots() The reverse roots of this Graph. |
public Collection | roots() The roots of this Graph. |
public int | size() Returns the number of nodes in this Graph. |
public Collection | succs(GraphNode v) Return the successors of a given node. |
public String | toString() |