mxGraph 2.4.0.0


com.mxgraph.analysis
Class mxGraphStructure

java.lang.Object
  extended by com.mxgraph.analysis.mxGraphStructure

public class mxGraphStructure
extends Object


Constructor Summary
mxGraphStructure()
           
 
Method Summary
static boolean areConnected(mxAnalysisGraph aGraph, Object sourceVertex, Object targetVertex)
           
static void complementaryGraph(mxAnalysisGraph aGraph)
          Makes the complement of aGraph
static Object getConnectingEdge(mxAnalysisGraph aGraph, Object vertexOne, Object vertexTwo)
           
static Object[] getCutEdges(mxAnalysisGraph aGraph)
           
static Object[] getCutVertices(mxAnalysisGraph aGraph)
           
static Object getDirectedLeaf(mxAnalysisGraph aGraph, Object parent)
           
static Object[][] getGraphComponents(mxAnalysisGraph aGraph)
           
static Object getLowestDegreeVertex(mxAnalysisGraph aGraph, Object[] omitVertex)
           
static Object[] getSinkVertices(mxAnalysisGraph aGraph)
           
static Object[] getSourceVertices(mxAnalysisGraph aGraph)
           
static Object getVertexWithValue(mxAnalysisGraph aGraph, int value)
           
static int indegree(mxAnalysisGraph aGraph, Object vertex)
           
static boolean isBiconnected(mxAnalysisGraph aGraph)
           
static boolean isConnected(mxAnalysisGraph aGraph)
           
static boolean isCutEdge(mxAnalysisGraph aGraph, Object edge)
           
static boolean isCutVertex(mxAnalysisGraph aGraph, Object vertex)
           
static boolean isCyclicDirected(mxAnalysisGraph aGraph)
           
static boolean isCyclicUndirected(mxAnalysisGraph aGraph)
           
static boolean isSimple(mxAnalysisGraph aGraph)
           
static boolean isTree(mxAnalysisGraph aGraph)
           
static void makeConnected(mxAnalysisGraph aGraph)
          Makes the graph connected
static void makeSimple(mxAnalysisGraph aGraph)
           
static void makeTreeDirected(mxAnalysisGraph aGraph, Object startVertex)
          Makes a tree graph directed from the source to the leaves
static int outdegree(mxAnalysisGraph aGraph, Object vertex)
           
static int regularity(mxAnalysisGraph aGraph)
           
static void setDefaultGraphStyle(mxAnalysisGraph aGraph, boolean resetEdgeValues)
          Sets the style of the graph to that as in GraphEditor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

mxGraphStructure

public mxGraphStructure()
Method Detail

isConnected

public static boolean isConnected(mxAnalysisGraph aGraph)
Parameters:
aGraph -
Returns:
true if the graph is connected

isCyclicUndirected

public static boolean isCyclicUndirected(mxAnalysisGraph aGraph)
Parameters:
aGraph -
parent -
Returns:
true if the graph contains cycles regardless of edge direction

isSimple

public static boolean isSimple(mxAnalysisGraph aGraph)
Parameters:
aGraph -
Returns:
true if the graph is simple (no self loops and no multiple edges)

isTree

public static boolean isTree(mxAnalysisGraph aGraph)
Parameters:
aGraph -
Returns:
true if the graph has the structure of a tree, regardless of edge direction

getLowestDegreeVertex

public static Object getLowestDegreeVertex(mxAnalysisGraph aGraph,
                                           Object[] omitVertex)
Parameters:
aGraph -
omitVertex - vertices in this array will be omitted, set this parameter to null if you don't want this feature
Returns:
a vertex that has lowest degree, or one of those in case if there are more

areConnected

public static boolean areConnected(mxAnalysisGraph aGraph,
                                   Object sourceVertex,
                                   Object targetVertex)
Parameters:
graph -
sourceVertex -
targetVertex -
Returns:
Returns true if the two vertices are connected directly by an edge. If directed, the result is true if they are connected by an edge that points from source to target, if false direction isn't takein into account, just connectivity.

makeSimple

public static void makeSimple(mxAnalysisGraph aGraph)
Parameters:
graph - Make a graph simple (remove parallel edges and self loops)

makeConnected

public static void makeConnected(mxAnalysisGraph aGraph)
Makes the graph connected

Parameters:
aGraph -

getGraphComponents

public static Object[][] getGraphComponents(mxAnalysisGraph aGraph)
Parameters:
aGraph -
Returns:
Object[components][vertices]

makeTreeDirected

public static void makeTreeDirected(mxAnalysisGraph aGraph,
                                    Object startVertex)
                             throws StructuralException
Makes a tree graph directed from the source to the leaves

Parameters:
aGraph -
startVertex - - this vertex will be root of the tree (the only source node)
Throws:
StructuralException - - the graph must be a tree (edge direction doesn't matter)

getConnectingEdge

public static Object getConnectingEdge(mxAnalysisGraph aGraph,
                                       Object vertexOne,
                                       Object vertexTwo)
Parameters:
aGraph -
vertexOne -
vertexTwo -
Returns:
an edge that directly connects vertexOne and vertexTwo regardless of direction, null if they are not connected directly

isCyclicDirected

public static boolean isCyclicDirected(mxAnalysisGraph aGraph)
Parameters:
graph -
Returns:
Returns true if the graph has at least one cycle, taking edge direction into account

getDirectedLeaf

public static Object getDirectedLeaf(mxAnalysisGraph aGraph,
                                     Object parent)
Parameters:
graph -
parent -
properties -
Returns:
A helper function for isDirectedCyclic and it isn't for general use. It returns a node that hasn't incoming or outgoing edges. It could be considered a "leaf" in a directed graph, but this definition isn't formal.

complementaryGraph

public static void complementaryGraph(mxAnalysisGraph aGraph)
Makes the complement of aGraph

Parameters:
aGraph -

getVertexWithValue

public static Object getVertexWithValue(mxAnalysisGraph aGraph,
                                        int value)
Parameters:
aGraph - - the graph to search
value - - desired value
Returns:
the first vertex with the wanted value. If none are found, null is returned

setDefaultGraphStyle

public static void setDefaultGraphStyle(mxAnalysisGraph aGraph,
                                        boolean resetEdgeValues)
Sets the style of the graph to that as in GraphEditor

Parameters:
aGraph -
resetEdgeValues - - set to true if you want to re-generate edge weights

regularity

public static int regularity(mxAnalysisGraph aGraph)
                      throws StructuralException
Parameters:
aGraph -
Returns:
the regularity of the graph
Throws:
StructuralException - if the graph is irregular

indegree

public static int indegree(mxAnalysisGraph aGraph,
                           Object vertex)
Parameters:
aGraph -
vertex -
Returns:
indegree of vertex

outdegree

public static int outdegree(mxAnalysisGraph aGraph,
                            Object vertex)
Parameters:
aGraph -
vertex -
Returns:
outdegree of vertex

isCutVertex

public static boolean isCutVertex(mxAnalysisGraph aGraph,
                                  Object vertex)
Parameters:
aGraph -
vertex -
Returns:
true if vertex is a cut vertex

getCutVertices

public static Object[] getCutVertices(mxAnalysisGraph aGraph)
Parameters:
aGraph -
Returns:
all cut vertices of aGraph

isCutEdge

public static boolean isCutEdge(mxAnalysisGraph aGraph,
                                Object edge)
Parameters:
aGraph -
edge -
Returns:
true if edge is a cut edge of aGraph

getCutEdges

public static Object[] getCutEdges(mxAnalysisGraph aGraph)
Parameters:
aGraph -
Returns:
all cut edges of aGraph

getSourceVertices

public static Object[] getSourceVertices(mxAnalysisGraph aGraph)
                                  throws StructuralException
Parameters:
aGraph -
Returns:
all source vertices of aGraph
Throws:
StructuralException - the graph must be directed

getSinkVertices

public static Object[] getSinkVertices(mxAnalysisGraph aGraph)
                                throws StructuralException
Parameters:
aGraph -
Returns:
all sink vertices of aGraph
Throws:
StructuralException - the graph must be directed

isBiconnected

public static boolean isBiconnected(mxAnalysisGraph aGraph)
Parameters:
aGraph -
Returns:
true if aGraph is biconnected

mxGraph 2.4.0.0


Copyright (c) 2010 Gaudenz Alder, David Benson. All rights reserved.