src/main/java/com/mxgraph/analysis/mxGraphStructure.java
public static int regularity(mxAnalysisGraph aGraph) throws StructuralException
	{
		mxGraph graph = aGraph.getGraph();
		Object[] vertices = aGraph.getChildVertices(graph.getDefaultParent());
		int vertexCount = vertices.length;
		Object currVertex = vertices[0];
		int regularity = aGraph.getEdges(currVertex, null, true, true).length;

		for (int i = 1; i < vertexCount; i++)
		{
			currVertex = vertices[i];

			if (regularity != aGraph.getEdges(currVertex, null, true, true).length)
			{
				throw new StructuralException("The graph is irregular.");
			}
		}

		return regularity;
	}
/**
	 * @param aGraph
	 * @return the regularity of the graph
	 * @throws StructuralException if the graph is irregular
	 */
@param aGraph
@return the regularity of the graph
@throws StructuralException if the graph is irregular
@param aGraph @return the regularity of the graph @throws StructuralException if the graph is irregular
public static int regularity(mxAnalysisGraph aGraph) throws StructuralException
	{
		mxGraph graph = aGraph.getGraph();
		Object[] vertices = aGraph.getChildVertices(graph.getDefaultParent());
		int vertexCount = vertices.length;
		Object currVertex = vertices[0];
		int regularity = aGraph.getEdges(currVertex, null, true, true).length;
		for (int i = 1; i < vertexCount; i++)
		{
			currVertex = vertices[i];
			if (regularity != aGraph.getEdges(currVertex, null, true, true).length)
			{
				throw new StructuralException("The graph is irregular.");
			}
		}
		return regularity;
	}
public static int regularity ( mxAnalysisGraph aGraph ) throws StructuralException { mxGraph graph = aGraph . getGraph ( ) ; Object [ ] vertices = aGraph . getChildVertices ( graph . getDefaultParent ( ) ) ; int vertexCount = vertices . length ; Object currVertex = vertices [ 0 ] ; int regularity = aGraph . getEdges ( currVertex , null , true , true ) . length ; for ( int i = 1 ; i < vertexCount ; i ++ ) { currVertex = vertices [ i ] ; if ( regularity != aGraph . getEdges ( currVertex , null , true , true ) . length ) { throw new StructuralException ( "The graph is irregular." ) ; } } return regularity ; }
@param aGraph
 @return the regularity of the graph
 @throws StructuralException if the graph is irregular
@param aGraph @return the regularity of the graph @throws StructuralException if the graph is irregular