|
mxGraph 1.10.2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.mxgraph.analysis.mxGraphAnalysis
public class mxGraphAnalysis
A singleton class that provides algorithms for graphs. Assume these
variables for the following examples:
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
Field Summary | |
---|---|
protected static mxGraphAnalysis |
instance
Holds the shared instance of this class. |
Constructor Summary | |
---|---|
protected |
mxGraphAnalysis()
|
Method Summary | |
---|---|
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 . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static mxGraphAnalysis instance
Constructor Detail |
---|
protected mxGraphAnalysis()
Method Detail |
---|
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 length
createPriorityQueue()
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 order
cells
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 costs
protected mxUnionFind createUnionFind(Object[] v)
v
- the array of all elements
v
protected mxFibonacciHeap createPriorityQueue()
|
mxGraph 1.10.2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |