|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoxi.util.datatypes.UndirectedGraph<N>
public class UndirectedGraph<N>
Straightforward undirected graph implementation. Nodes are generic type N.
Constructor Summary | |
---|---|
UndirectedGraph()
|
Method Summary | |
---|---|
void |
add(N node)
Add a node. |
void |
connect(N nodeA,
N nodeB)
Add a link. |
void |
disconnect(N nodeA,
N nodeB)
Remove the specified link. |
java.util.Set<N> |
getConnectedNodesFor(N node)
Report all the neighbors of node. |
java.util.Set<N> |
getNodes()
Returns an unmodifiable Set view of the nodes contained in this graph. |
void |
remove(N node)
Remove node and any links that use node. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UndirectedGraph()
Method Detail |
---|
public void add(N node)
node
- the node to addpublic void connect(N nodeA, N nodeB) throws java.lang.NullPointerException
nodeA
- one end of the linknodeB
- the other end of the link
java.lang.NullPointerException
- if either endpoint is not in graphpublic void disconnect(N nodeA, N nodeB) throws java.lang.NullPointerException
nodeA
- one end of the linknodeB
- the other end of the link
java.lang.NullPointerException
- if either endpoint is not in graphpublic java.util.Set<N> getConnectedNodesFor(N node) throws java.lang.NullPointerException
node
- the node
java.lang.NullPointerException
- if node does not appear in graphpublic java.util.Set<N> getNodes()
public void remove(N node)
node
- the node to remove.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |