|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
E
- Type of elementspublic interface Graph<E>
A Graph provides basic operations to create, search and change itself.
Method Summary | |
---|---|
boolean |
addAllNodes(java.util.Collection<Node<E>> nodes)
add all the nodes to graph. |
boolean |
addEdge(Edge<E> edge)
Add an edge to this graph. |
boolean |
addEdge(E start,
E end,
double weight)
add one edge to graph. |
boolean |
addEdge(Node<E> start,
Node<E> end,
double weight)
add one edge to graph with weight. |
Node<E> |
addNode(E e)
Add a node to graph, which contains value e. |
Node<E> |
addNode(Node<E> node)
Add a node to graph, which contains value e. |
Graph<E> |
clone()
Clone this graph. |
boolean |
containsEdge(E start,
E end)
Returns whether this graph contains an edge between start and end. |
boolean |
containsNode(Node<E> start)
whether this graph contains the specified node. |
java.util.Collection<Node<E>> |
getAllNodes()
get all the nodes in the graph. |
java.util.Collection<Edge<E>> |
getEdges(E start,
E end)
get all the edge start from the nodes which contain value start and end. |
java.util.Collection<Edge<E>> |
getEdges(Node<E> start,
Node<E> end)
get all all the edges which start from node start and end with node end. |
java.util.Collection<Edge<E>> |
getLinkedEdges(Node<E> node)
get all edges directly linked to the specified node . |
java.util.Collection<AdjacentNode<E>> |
getLinkedNodes(Node<E> node)
get all nodes which directly linked to node . |
java.util.Collection<Node<E>> |
getNodes(E e)
get all nodes whose value equal to e . |
boolean |
removeEdge(Edge<E> edge)
remove all the edges which start from start and end to end. |
boolean |
removeEdge(E start,
E end)
remove all the edges which start from start and end to end. |
boolean |
removeEdge(Node<E> start,
Node<E> end)
remove all the edges which start from start and end to
end . |
boolean |
removeNode(Node<E> node)
remove the node from the graph. |
Methods inherited from interface java.util.Collection |
---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Method Detail |
---|
java.util.Collection<Node<E>> getNodes(E e)
e
.
e
- value to be got
java.util.Collection<Node<E>> getAllNodes()
java.util.Collection<Edge<E>> getEdges(Node<E> start, Node<E> end)
start
- the start node of the edgeend
- the end node of the edge
java.util.Collection<Edge<E>> getEdges(E start, E end)
start
- start valueend
- end value
Node<E> addNode(E e)
e
, return the existing node instead of creating a new one. boolean addIfAbsent(E e)
method?
e
- the value to add.
Node<E> addNode(Node<E> node)
e
, return the existing node instead of creating a new one.
node
- the node to add
node
if succeed. If there is already a
graph node has the same value as node
, return node
in graph.boolean addAllNodes(java.util.Collection<Node<E>> nodes)
nodes
- nodes to be added
boolean addEdge(E start, E end, double weight)
start
- value in start node. A new node will be added to graph is this
value is not in graph yet.end
- value in end node. A new node will be added to graph is this
value is not in graph yet.weight
- weight of this edge
boolean addEdge(Node<E> start, Node<E> end, double weight)
start
- start node. A new node will be added to graph is this value is
not in graph yet.end
- end node. A new node will be added to graph is this value is
not in graph yet.weight
- weight of this edge
boolean addEdge(Edge<E> edge)
edge
- adding edge
java.util.Collection<AdjacentNode<E>> getLinkedNodes(Node<E> node)
node
.
node
- start node
java.util.Collection<Edge<E>> getLinkedEdges(Node<E> node)
node
.
node
- start node
boolean removeEdge(Node<E> start, Node<E> end)
start
and end to
end
.
start
- start nodeend
- end node
boolean removeEdge(Edge<E> edge)
edge
- edge removed
boolean removeEdge(E start, E end)
start
- start valueend
- end value
boolean removeNode(Node<E> node)
node
- node removed
boolean containsEdge(E start, E end)
start
- starting node of edgeend
- ending node of edge
Graph<E> clone() throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
- clone not supportedboolean containsNode(Node<E> start)
start
- the node
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |