public class mxGraphAnalysis
extends java.lang.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 | Description |
---|---|---|
protected static mxGraphAnalysis |
instance |
Holds the shared instance of this class.
|
Modifier | Constructor | Description |
---|---|---|
protected |
mxGraphAnalysis() |
Modifier and Type | Method | Description |
---|---|---|
protected mxFibonacciHeap |
createPriorityQueue() |
Hook for subclassers to provide a custom fibonacci heap.
|
protected mxUnionFind |
createUnionFind(java.lang.Object[] v) |
Hook for subclassers to provide a custom union find structure.
|
mxUnionFind |
getConnectionComponents(mxGraph graph,
java.lang.Object[] v,
java.lang.Object[] e) |
Returns a union find structure representing the connection components of
G=(E,V).
|
static mxGraphAnalysis |
getInstance() |
|
java.lang.Object[] |
getMinimumSpanningTree(mxGraph graph,
java.lang.Object[] v,
mxICostFunction cf,
boolean directed) |
Returns the minimum spanning tree (MST) for the graph defined by G=(E,V).
|
java.lang.Object[] |
getMinimumSpanningTree(mxGraph graph,
java.lang.Object[] v,
java.lang.Object[] e,
mxICostFunction cf) |
Returns the minimum spanning tree (MST) for the graph defined by G=(E,V).
|
java.lang.Object[] |
getShortestPath(mxGraph graph,
java.lang.Object from,
java.lang.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 java.lang.Object[] getShortestPath(mxGraph graph, java.lang.Object from, java.lang.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 java.lang.Object[] getMinimumSpanningTree(mxGraph graph, java.lang.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 java.lang.Object[] getMinimumSpanningTree(mxGraph graph, java.lang.Object[] v, java.lang.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, java.lang.Object[] v, java.lang.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(java.lang.Object[] v)
v
- the array of all elementsv
protected mxFibonacciHeap createPriorityQueue()
Copyright (c) 2010-2017 Gaudenz Alder, JGraph Ltd. All rights reserved.