|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The graph class allows you to build graphs of objects.
Nested Class Summary | |
static interface |
Graph.Edge
An edge is an ordered pair of nodes with a label attached to it. |
Method Summary | |
void |
addEdge(Graph.Edge edge)
Adds an edge to the graph. |
void |
addEdge(Object tail,
Object head,
Object label)
A convenient shortcut for addEdge(new Graph.Edge(tail, head,
label)) . |
void |
addNode(Object node)
Adds a node to the graph. |
Graph |
copy()
Creates a copy of this graph. |
List |
getIncomingEdges(Object node)
|
String |
getLabel()
Returns the graph's label. |
List |
getNodes()
Returns a list of nodes that this graph has. |
List |
getOutgoingEdges(Object node)
Returns a list of outgoing edges leaving this node. |
boolean |
hasEdge(Graph.Edge edge)
Returns true if the graph has this edge. |
boolean |
hasNode(Object node)
Returns true if the graph has this node. |
int |
incomingEdgeCount(Object node)
|
int |
nodeCount()
Returns the count of nodes in this graph. |
int |
outgoingEdgeCount(Object node)
Returns the number of outgoing edges this node has. |
void |
removeAll()
Removes all nodes and edges. |
boolean |
removeEdge(Graph.Edge edge)
Removes specified edge. |
boolean |
removeEdge(Object tail,
Object head,
Object label)
A convenient shortcut for removeEdge(new Graph.Edge(tail, head,
label)) . |
boolean |
removeNode(Object node)
Removes specified node and all edges incident to it. |
void |
setLabel(String label)
Sets the graph's label. |
Method Detail |
public Graph copy()
public void setLabel(String label)
public String getLabel()
public void addNode(Object node)
public boolean hasNode(Object node)
true
if the graph has this node.
public boolean hasEdge(Graph.Edge edge)
true
if the graph has this edge.
public int nodeCount()
public void addEdge(Graph.Edge edge)
public void addEdge(Object tail, Object head, Object label)
addEdge(new Graph.Edge(tail, head,
label))
.
addEdge(Graph.Edge)
public List getNodes()
public boolean removeNode(Object node)
public boolean removeEdge(Object tail, Object head, Object label)
removeEdge(new Graph.Edge(tail, head,
label))
.
removeEdge(Graph.Edge)
public boolean removeEdge(Graph.Edge edge)
public void removeAll()
public List getOutgoingEdges(Object node)
public int outgoingEdgeCount(Object node)
getOutgoingEdges(node).size()
.
getOutgoingEdges(Object)
public int incomingEdgeCount(Object node)
outgoingEdgeCount(Object)
public List getIncomingEdges(Object node)
getOutgoingEdges(Object)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |