2016/05/28 - Apache Tuscany has been retired.
For more information, please explore the Attic.
org.apache.tuscany.sca.databinding.impl
Class DirectedGraph<V,E>
java.lang.Object
org.apache.tuscany.sca.databinding.impl.DirectedGraph<V,E>
- Type Parameters:
V
- The type of vertex objectE
- The type of edge object
- All Implemented Interfaces:
- java.lang.Cloneable
public class DirectedGraph<V,E>
- extends java.lang.Object
- implements java.lang.Cloneable
Directed, weighted graph
Method Summary |
void |
addEdge(V soure,
V target)
|
void |
addEdge(V source,
V target,
E edgeValue,
int weight,
boolean publicEdge)
|
void |
addGraph(DirectedGraph<V,E> otherGraph)
|
java.lang.Object |
clone()
|
DirectedGraph.Edge |
getEdge(DirectedGraph.Vertex source,
DirectedGraph.Vertex target)
|
DirectedGraph.Edge |
getEdge(V source,
V target)
|
DirectedGraph.Path |
getShortestPath(V sourceValue,
V targetValue)
Get the shortest path from the source vertex to the target vertex using
Dijkstra's algorithm. |
DirectedGraph.Vertex |
getVertex(V source)
|
java.util.Map<V,DirectedGraph.Vertex> |
getVertices()
|
void |
removeEdge(DirectedGraph.Edge edge)
|
boolean |
removeEdge(V source,
V target)
|
void |
removeVertex(DirectedGraph.Vertex vertex)
|
java.util.List<V> |
topologicalSort(boolean readOnly)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
DirectedGraph
public DirectedGraph()
addEdge
public void addEdge(V source,
V target,
E edgeValue,
int weight,
boolean publicEdge)
addEdge
public void addEdge(V soure,
V target)
getVertex
public DirectedGraph.Vertex getVertex(V source)
removeEdge
public boolean removeEdge(V source,
V target)
removeEdge
public void removeEdge(DirectedGraph.Edge edge)
removeVertex
public void removeVertex(DirectedGraph.Vertex vertex)
getEdge
public DirectedGraph.Edge getEdge(DirectedGraph.Vertex source,
DirectedGraph.Vertex target)
getEdge
public DirectedGraph.Edge getEdge(V source,
V target)
getShortestPath
public DirectedGraph.Path getShortestPath(V sourceValue,
V targetValue)
- Get the shortest path from the source vertex to the target vertex using
Dijkstra's algorithm. If there's no path, null will be returned. If the
source is the same as the target, it returns a path with empty edges with
weight 0.
- Parameters:
sourceValue
- The value identifies the sourcetargetValue
- The value identifies the target
- Returns:
- The shortest path
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
getVertices
public java.util.Map<V,DirectedGraph.Vertex> getVertices()
addGraph
public void addGraph(DirectedGraph<V,E> otherGraph)
topologicalSort
public java.util.List<V> topologicalSort(boolean readOnly)
clone
public java.lang.Object clone()
- Overrides:
clone
in class java.lang.Object