|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DGraph
A directed graph.
Field Summary | |
---|---|
static DGraph |
EMPTY_GRAPH
An empty directed graph. |
Method Summary | |
---|---|
void |
addEdge(java.lang.Object parent,
java.lang.Object child)
Adds to the graph an edge from parent to
child . |
boolean |
addNode(java.lang.Object v)
Adds the given object as a node in the graph. |
java.util.Set |
getAncestors(java.lang.Object v)
Returns the set of ancestors of the given node, including the node itself. |
java.util.Set |
getChildren(java.lang.Object v)
Returns an unmodifiable set consisting of the given object's children, or null if the object is not in the graph. |
java.util.Set |
getDescendants(java.lang.Object v)
Returns the set of descendants of the given node, including the node itself. |
java.util.Set |
getParents(java.lang.Object v)
Returns an unmodifiable set consisting of the given object's parents, or null if the object is not in the graph. |
java.util.Set |
getRoots()
Returns the set of nodes in this graph that have no parents. |
java.util.Set |
nodes()
Returns an unmodifiable set consisting of the nodes in this graph. |
void |
print(java.io.PrintStream s)
Prints a description of this graph to the given stream. |
void |
removeEdge(java.lang.Object parent,
java.lang.Object child)
Removes the edge from parent to child from
the graph. |
boolean |
removeNode(java.lang.Object v)
Removes the given node from the graph, along with all the edges incident on it. |
void |
setParents(java.lang.Object v,
java.util.Set parents)
Changes the graph so that the parent set of the given node is the given set. |
Field Detail |
---|
static final DGraph EMPTY_GRAPH
Method Detail |
---|
java.util.Set nodes()
boolean addNode(java.lang.Object v)
boolean removeNode(java.lang.Object v)
void addEdge(java.lang.Object parent, java.lang.Object child)
parent
to
child
. Automatically adds these nodes to the graph
if they were not already present.
void removeEdge(java.lang.Object parent, java.lang.Object child)
parent
to child
from
the graph. This method has no effect if the edge was not present; it
is safe to call even if the given nodes are not in the graph.
java.util.Set getParents(java.lang.Object v)
void setParents(java.lang.Object v, java.util.Set parents)
java.util.Set getChildren(java.lang.Object v)
java.util.Set getRoots()
java.util.Set getAncestors(java.lang.Object v)
java.lang.NullPointerException
- if the given object is not in the graphjava.util.Set getDescendants(java.lang.Object v)
java.lang.NullPointerException
- if the given object is not in the graphvoid print(java.io.PrintStream s)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |