Class mxGraphStructure


  • public class mxGraphStructure
    extends java.lang.Object
    • 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 java.lang.Object getLowestDegreeVertex​(mxAnalysisGraph aGraph,
                                                             java.lang.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,
                                           java.lang.Object sourceVertex,
                                           java.lang.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 java.lang.Object[][] getGraphComponents​(mxAnalysisGraph aGraph)
        Parameters:
        aGraph -
        Returns:
        Object[components][vertices]
      • makeTreeDirected

        public static void makeTreeDirected​(mxAnalysisGraph aGraph,
                                            java.lang.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 java.lang.Object getConnectingEdge​(mxAnalysisGraph aGraph,
                                                         java.lang.Object vertexOne,
                                                         java.lang.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 java.lang.Object getDirectedLeaf​(mxAnalysisGraph aGraph,
                                                       java.lang.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 java.lang.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
      • indegree

        public static int indegree​(mxAnalysisGraph aGraph,
                                   java.lang.Object vertex)
        Parameters:
        aGraph -
        vertex -
        Returns:
        indegree of vertex
      • outdegree

        public static int outdegree​(mxAnalysisGraph aGraph,
                                    java.lang.Object vertex)
        Parameters:
        aGraph -
        vertex -
        Returns:
        outdegree of vertex
      • isCutVertex

        public static boolean isCutVertex​(mxAnalysisGraph aGraph,
                                          java.lang.Object vertex)
        Parameters:
        aGraph -
        vertex -
        Returns:
        true if vertex is a cut vertex
      • getCutVertices

        public static java.lang.Object[] getCutVertices​(mxAnalysisGraph aGraph)
        Parameters:
        aGraph -
        Returns:
        all cut vertices of aGraph
      • isCutEdge

        public static boolean isCutEdge​(mxAnalysisGraph aGraph,
                                        java.lang.Object edge)
        Parameters:
        aGraph -
        edge -
        Returns:
        true if edge is a cut edge of aGraph
      • getCutEdges

        public static java.lang.Object[] getCutEdges​(mxAnalysisGraph aGraph)
        Parameters:
        aGraph -
        Returns:
        all cut edges of aGraph
      • isBiconnected

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