public class mxTraversal extends Object
Constructor and Description |
---|
mxTraversal() |
Modifier and Type | Method and Description |
---|---|
static List<Map<Object,Object>> |
bellmanFord(mxAnalysisGraph aGraph,
Object startVertex)
Implements the Bellman-Ford shortest path from startVertex to all vertices.
|
static void |
bfs(mxAnalysisGraph aGraph,
Object startVertex,
mxGraph.mxICellVisitor visitor)
Implements a recursive breadth first search starting from the specified
cell.
|
static void |
dfs(mxAnalysisGraph aGraph,
Object startVertex,
mxGraph.mxICellVisitor visitor)
Implements a recursive depth first search starting from the specified
cell.
|
static void |
dijkstra(mxAnalysisGraph aGraph,
Object startVertex,
Object endVertex,
mxGraph.mxICellVisitor visitor)
Implements the Dijkstra's shortest path from startVertex to endVertex.
|
static ArrayList<Object[][]> |
floydRoyWarshall(mxAnalysisGraph aGraph)
Implements the Floyd-Roy-Warshall (aka WFI) shortest path algorithm between all vertices.
|
static Object[] |
getWFIPath(mxAnalysisGraph aGraph,
ArrayList<Object[][]> FWIresult,
Object startVertex,
Object targetVertex)
This method helps the user to get the desired data from the result of the Floyd-Roy-Warshall algorithm.
|
public static void dfs(mxAnalysisGraph aGraph, Object startVertex, mxGraph.mxICellVisitor visitor)
mxTraversal.bfs(analysisGraph, startVertex, new mxICellVisitor() { public boolean visit(Object vertex, Object edge) { // perform your processing on each cell here return false; } });
aGraph
- the graphstartVertex
- visitor
- public static void bfs(mxAnalysisGraph aGraph, Object startVertex, mxGraph.mxICellVisitor visitor)
mxTraversal.bfs(analysisGraph, startVertex, new mxICellVisitor() { public boolean visit(Object vertex, Object edge) { // perform your processing on each cell here return false; } });
aGraph
- the graphstartVertex
- visitor
- public static void dijkstra(mxAnalysisGraph aGraph, Object startVertex, Object endVertex, mxGraph.mxICellVisitor visitor) throws StructuralException
mxTraversal.dijkstra(analysisGraph, startVertex, endVertex, new mxICellVisitor() { public boolean visit(Object vertex, Object edge) { // perform your processing on each cell here return false; } });
aGraph
- startVertex
- endVertex
- visitor
- StructuralException
- - The current Dijkstra algorithm only works for connected graphspublic static List<Map<Object,Object>> bellmanFord(mxAnalysisGraph aGraph, Object startVertex) throws StructuralException
aGraph
- startVertex
- StructuralException
- - The Bellman-Ford algorithm only works for graphs without negative cyclespublic static ArrayList<Object[][]> floydRoyWarshall(mxAnalysisGraph aGraph) throws StructuralException
aGraph
- StructuralException
- - The Floyd-Roy-Warshall algorithm only works for graphs without negative cyclespublic static Object[] getWFIPath(mxAnalysisGraph aGraph, ArrayList<Object[][]> FWIresult, Object startVertex, Object targetVertex) throws StructuralException
aGraph
- FWIresult
- - the result of the Floyd-Roy-Warhall algorithmstartVertex
- targetVertex
- StructuralException
- - The Floyd-Roy-Warshall algorithm only works for graphs without negative cyclesCopyright (c) 2010 Gaudenz Alder, David Benson. All rights reserved.