public class mxGraphAnalysis extends Object
mxICostFunction cf = mxDistanceCostFunction();
Object[] v = graph.getChildVertices(graph.getDefaultParent());
Object[] e = graph.getChildEdges(graph.getDefaultParent());
mxGraphAnalysis mga = mxGraphAnalysis.getInstance();
Object[] path = mga.getShortestPath(graph, from, to, cf, v.length, true);
mga.getMinimumSpanningTree(graph, v, cf, true))
mga.getMinimumSpanningTree(graph, v, e, cf))
boolean connected = uf.differ(vertex1, vertex2)
.mxICostFunction
Modifier and Type | Field and Description |
---|---|
protected static mxGraphAnalysis |
instance
Holds the shared instance of this class.
|
Modifier | Constructor and Description |
---|---|
protected |
mxGraphAnalysis() |
Modifier and Type | Method and Description |
---|---|
protected mxFibonacciHeap |
createPriorityQueue()
Hook for subclassers to provide a custom fibonacci heap.
|
protected mxUnionFind |
createUnionFind(Object[] v)
Hook for subclassers to provide a custom union find structure.
|
mxUnionFind |
getConnectionComponents(mxGraph graph,
Object[] v,
Object[] e)
Returns a union find structure representing the connection components of
G=(E,V).
|
static mxGraphAnalysis |
getInstance() |
Object[] |
getMinimumSpanningTree(mxGraph graph,
Object[] v,
mxICostFunction cf,
boolean directed)
Returns the minimum spanning tree (MST) for the graph defined by G=(E,V).
|
Object[] |
getMinimumSpanningTree(mxGraph graph,
Object[] v,
Object[] e,
mxICostFunction cf)
Returns the minimum spanning tree (MST) for the graph defined by G=(E,V).
|
Object[] |
getShortestPath(mxGraph graph,
Object from,
Object to,
mxICostFunction cf,
int steps,
boolean directed)
Returns the shortest path between two cells or their descendants
represented as an array of edges in order of traversal.
|
static void |
setInstance(mxGraphAnalysis instance)
Sets the shared instance of this class.
|
mxCellState[] |
sort(mxCellState[] states,
mxICostFunction cf)
Returns a sorted set for
cells with respect to
cf . |
double |
sum(mxCellState[] states,
mxICostFunction cf)
Returns the sum of all cost for
cells with respect to
cf . |
protected static mxGraphAnalysis instance
public static mxGraphAnalysis getInstance()
public static void setInstance(mxGraphAnalysis instance)
instance
- The instance to set.public Object[] getShortestPath(mxGraph graph, Object from, Object to, mxICostFunction cf, int steps, boolean directed)
graph
- The object that defines the graph structurefrom
- The source cell.to
- The target cell (aka sink).cf
- The cost function that defines the edge length.steps
- The maximum number of edges to traverse.directed
- If edge directions should be taken into account.from
and ending with
to
.createPriorityQueue()
public Object[] getMinimumSpanningTree(mxGraph graph, Object[] v, mxICostFunction cf, boolean directed)
graph
- the object that describes the graphv
- the vertices of the graphcf
- the cost function that defines the edge lengthcreatePriorityQueue()
public Object[] getMinimumSpanningTree(mxGraph graph, Object[] v, Object[] e, mxICostFunction cf)
graph
- The object that contains the graph.v
- The vertices of the graph.e
- The edges of the graph.cf
- The cost function that defines the edge length.getMinimumSpanningTree(mxGraph, Object[], mxICostFunction,
boolean)
,
createUnionFind(Object[])
public mxUnionFind getConnectionComponents(mxGraph graph, Object[] v, Object[] e)
graph
- The object that contains the graph.v
- The vertices of the graph.e
- The edges of the graph.createUnionFind(Object[])
public mxCellState[] sort(mxCellState[] states, mxICostFunction cf)
cells
with respect to
cf
.states
- the cell states to sortcf
- the cost function that defines the ordercells
wrt.
cf
public double sum(mxCellState[] states, mxICostFunction cf)
cells
with respect to
cf
.states
- the cell states to use for the sumcf
- the cost function that defines the costsprotected mxUnionFind createUnionFind(Object[] v)
v
- the array of all elementsv
protected mxFibonacciHeap createPriorityQueue()
Copyright (c) 2010 Gaudenz Alder, David Benson. All rights reserved.