|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.amino.ds.graph.AbstractGraph<E> org.amino.ds.graph.DirectedGraphImpl<E>
E
- Type of element in graph nodespublic class DirectedGraphImpl<E>
Sample implementation of interface DirectedGraph. This graph is based on adjacent list expression.
Constructor Summary | |
---|---|
DirectedGraphImpl()
|
Method Summary | |
---|---|
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. |
Graph<E> |
clone()
Clone this graph. |
java.util.Collection<Node<E>> |
getDestinations(Node<E> node)
Get nodes started with start node. |
java.util.Collection<Edge<E>> |
getIncoming(Node<E> node)
Get edges ended with end node. |
java.util.Collection<Edge<E>> |
getOutgoing(Node<E> node)
Get edges started with start node. |
java.util.Collection<Node<E>> |
getSources(Node<E> node)
Get nodes end with end node. |
java.util.Collection<AdjacentNode<E>> |
getWeightDestinations(Node<E> start)
Get weighted edges started with start node. |
java.util.Collection<AdjacentNode<E>> |
getWeightSources(Node<E> end)
Get weighted edges ended with end node. |
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 class org.amino.ds.graph.AbstractGraph |
---|
add, addAll, addAllNodes, addNode, addNode, clear, contains, containsAll, containsEdge, containsNode, dumpGraph, freeMultiOwnerShip, getAllNodes, getEdges, getEdges, getLinkedEdges, getLinkedNodes, getMultiOwnerShip, getNodes, isEmpty, iterator, remove, removeAll, retainAll, simpleContentionManager, simpleContentionManager, size, toArray, toArray |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.amino.ds.graph.Graph |
---|
addAllNodes, addNode, addNode, containsEdge, containsNode, getAllNodes, getEdges, getEdges, getLinkedEdges, getLinkedNodes, getNodes |
Methods inherited from interface java.util.Collection |
---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Constructor Detail |
---|
public DirectedGraphImpl()
Method Detail |
---|
public boolean addEdge(Node<E> start, Node<E> end, double weight)
addEdge
in interface Graph<E>
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
public boolean removeEdge(Node<E> start, Node<E> end)
start
and end to
end
.
removeEdge
in interface Graph<E>
start
- start nodeend
- end node
public boolean removeEdge(E start, E end)
removeEdge
in interface Graph<E>
start
- start valueend
- end value
public boolean removeEdge(Edge<E> edge)
removeEdge
in interface Graph<E>
edge
- edge removed
public boolean addEdge(Edge<E> edge)
addEdge
in interface Graph<E>
edge
- adding edge
public boolean addEdge(E start, E end, double weight)
addEdge
in interface Graph<E>
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
public java.util.Collection<Node<E>> getDestinations(Node<E> node)
getDestinations
in interface DirectedGraph<E>
node
- start node
public java.util.Collection<Edge<E>> getIncoming(Node<E> node)
getIncoming
in interface DirectedGraph<E>
node
- end node
public java.util.Collection<Edge<E>> getOutgoing(Node<E> node)
getOutgoing
in interface DirectedGraph<E>
node
- start node
public java.util.Collection<Node<E>> getSources(Node<E> node)
getSources
in interface DirectedGraph<E>
node
- end node
public Graph<E> clone()
clone
in interface Graph<E>
clone
in class AbstractGraph<E>
public boolean removeNode(Node<E> node)
removeNode
in interface Graph<E>
removeNode
in class AbstractGraph<E>
node
- node removed
public java.util.Collection<AdjacentNode<E>> getWeightDestinations(Node<E> start)
getWeightDestinations
in interface DirectedGraph<E>
start
- start node
public java.util.Collection<AdjacentNode<E>> getWeightSources(Node<E> end)
getWeightSources
in interface DirectedGraph<E>
end
- end node
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |