Package com.mxgraph.analysis
Class mxGraphStructure
java.lang.Object
com.mxgraph.analysis.mxGraphStructure
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
areConnected
(mxAnalysisGraph aGraph, Object sourceVertex, Object targetVertex) static void
complementaryGraph
(mxAnalysisGraph aGraph) Makes the complement of aGraphstatic 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 connectedstatic void
makeSimple
(mxAnalysisGraph aGraph) static void
makeTreeDirected
(mxAnalysisGraph aGraph, Object startVertex) Makes a tree graph directed from the source to the leavesstatic 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
-
Constructor Details
-
mxGraphStructure
public mxGraphStructure()
-
-
Method Details
-
isConnected
- Parameters:
aGraph
-- Returns:
- true if the graph is connected
-
isCyclicUndirected
- Parameters:
aGraph
-parent
-- Returns:
- true if the graph contains cycles regardless of edge direction
-
isSimple
- Parameters:
aGraph
-- Returns:
- true if the graph is simple (no self loops and no multiple edges)
-
isTree
- Parameters:
aGraph
-- Returns:
- true if the graph has the structure of a tree, regardless of edge direction
-
getLowestDegreeVertex
- 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:
sourceVertex
-targetVertex
-graph
-- 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
- Parameters:
graph
- Make a graph simple (remove parallel edges and self loops)
-
makeConnected
Makes the graph connected- Parameters:
aGraph
-
-
getGraphComponents
- 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
- Parameters:
aGraph
-vertexOne
-vertexTwo
-- Returns:
- an edge that directly connects vertexOne and vertexTwo regardless of direction, null if they are not connected directly
-
isCyclicDirected
- Parameters:
graph
-- Returns:
- Returns true if the graph has at least one cycle, taking edge direction into account
-
getDirectedLeaf
- Parameters:
parent
-graph
-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
Makes the complement of aGraph- Parameters:
aGraph
-
-
getVertexWithValue
- Parameters:
aGraph
- - the graph to searchvalue
- - desired value- Returns:
- the first vertex with the wanted value. If none are found, null is returned
-
setDefaultGraphStyle
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
- Parameters:
aGraph
-- Returns:
- the regularity of the graph
- Throws:
StructuralException
- if the graph is irregular
-
indegree
- Parameters:
aGraph
-vertex
-- Returns:
- indegree of vertex
-
outdegree
- Parameters:
aGraph
-vertex
-- Returns:
- outdegree of vertex
-
isCutVertex
- Parameters:
aGraph
-vertex
-- Returns:
- true if vertex is a cut vertex
-
getCutVertices
- Parameters:
aGraph
-- Returns:
- all cut vertices of aGraph
-
isCutEdge
- Parameters:
aGraph
-edge
-- Returns:
- true if edge is a cut edge of aGraph
-
getCutEdges
- Parameters:
aGraph
-- Returns:
- all cut edges of aGraph
-
getSourceVertices
- Parameters:
aGraph
-- Returns:
- all source vertices of aGraph
- Throws:
StructuralException
- the graph must be directed
-
getSinkVertices
- Parameters:
aGraph
-- Returns:
- all sink vertices of aGraph
- Throws:
StructuralException
- the graph must be directed
-
isBiconnected
- Parameters:
aGraph
-- Returns:
- true if aGraph is biconnected
-