src/main/java/com/mxgraph/analysis/mxGraphGenerator.java
public void oneSpanningTree(mxAnalysisGraph aGraph, boolean forceConnected, boolean forceSimple) throws StructuralException
	{
		mxGraph graph = aGraph.getGraph();

		boolean isSimple = mxGraphStructure.isSimple(aGraph);
		boolean isConnected = mxGraphStructure.isConnected(aGraph);

		if (!isSimple)
		{
			if (forceSimple)
			{
				mxGraphStructure.makeSimple(aGraph);
			}
			else
			{
				throw new StructuralException("Graph is not simple.");
			}
		}

		if (!isConnected)
		{
			if (forceConnected)
			{
				mxGraphStructure.makeConnected(aGraph);
			}
			else
			{
				throw new StructuralException("Graph is not connected.");
			}
		}

		Object[] edges = aGraph.getChildEdges(graph.getDefaultParent());
		int edgeCount = edges.length;

		for (int i = 0; i < edgeCount; i++)
		{
			Object currEdge = edges[i];
			graph.removeCells(new Object[] { currEdge });

			if (!mxGraphStructure.isConnected(aGraph))
			{
				graph.addCell(currEdge);
			}
		}
	}
/**
	 * @param graph
	 * @param forceConnected if true, an unconnected graph is made connected
	 * @param forceSimple if true, a non-simple graph is made simple
	 * Calculates one spanning tree of graph, which doesn't have to be but can be minimal
	 * (this is faster than minimal spanning tree, so if you need any spanning tree, use this one)
	 * Self loops and multiple edges are automatically removed!
	 * Also, unconnected graphs are made connected!
	 * @throws StructuralException the graph has to be simple (no self-loops and no multiple edges) 
	 */
@param graph
@param forceConnected if true, an unconnected graph is made connected
@param forceSimple if true, a non-simple graph is made simple
Calculates one spanning tree of graph, which doesn't have to be but can be minimal
(this is faster than minimal spanning tree, so if you need any spanning tree, use this one)
Self loops and multiple edges are automatically removed.
Also, unconnected graphs are made connected.
@throws StructuralException the graph has to be simple (no self-loops and no multiple edges)
@param graph @param forceConnected if true an unconnected graph is made connected @param forceSimple if true a non - simple graph is made simple Calculates one spanning tree of graph which doesn ' t have to be but can be minimal ( this is faster than minimal spanning tree so if you need any spanning tree use this one ) Self loops and multiple edges are automatically removed . Also unconnected graphs are made connected . @throws StructuralException the graph has to be simple ( no self - loops and no multiple edges )
public void oneSpanningTree(mxAnalysisGraph aGraph, boolean forceConnected, boolean forceSimple) throws StructuralException
	{
		mxGraph graph = aGraph.getGraph();
		boolean isSimple = mxGraphStructure.isSimple(aGraph);
		boolean isConnected = mxGraphStructure.isConnected(aGraph);
		if (!isSimple)
		{
			if (forceSimple)
			{
				mxGraphStructure.makeSimple(aGraph);
			}
			else
			{
				throw new StructuralException("Graph is not simple.");
			}
		}
		if (!isConnected)
		{
			if (forceConnected)
			{
				mxGraphStructure.makeConnected(aGraph);
			}
			else
			{
				throw new StructuralException("Graph is not connected.");
			}
		}
		Object[] edges = aGraph.getChildEdges(graph.getDefaultParent());
		int edgeCount = edges.length;
		for (int i = 0; i < edgeCount; i++)
		{
			Object currEdge = edges[i];
			graph.removeCells(new Object[] { currEdge });
			if (!mxGraphStructure.isConnected(aGraph))
			{
				graph.addCell(currEdge);
			}
		}
	}
public void oneSpanningTree ( mxAnalysisGraph aGraph , boolean forceConnected , boolean forceSimple ) throws StructuralException { mxGraph graph = aGraph . getGraph ( ) ; boolean isSimple = mxGraphStructure . isSimple ( aGraph ) ; boolean isConnected = mxGraphStructure . isConnected ( aGraph ) ; if ( ! isSimple ) { if ( forceSimple ) { mxGraphStructure . makeSimple ( aGraph ) ; } else { throw new StructuralException ( "Graph is not simple." ) ; } } if ( ! isConnected ) { if ( forceConnected ) { mxGraphStructure . makeConnected ( aGraph ) ; } else { throw new StructuralException ( "Graph is not connected." ) ; } } Object [ ] edges = aGraph . getChildEdges ( graph . getDefaultParent ( ) ) ; int edgeCount = edges . length ; for ( int i = 0 ; i < edgeCount ; i ++ ) { Object currEdge = edges [ i ] ; graph . removeCells ( new Object [ ] { currEdge } ) ; if ( ! mxGraphStructure . isConnected ( aGraph ) ) { graph . addCell ( currEdge ) ; } } }
@param graph
 @param forceConnected if true, an unconnected graph is made connected
 @param forceSimple if true, a non-simple graph is made simple
 Calculates one spanning tree of graph, which doesn't have to be but can be minimal
 (this is faster than minimal spanning tree, so if you need any spanning tree, use this one)
 Self loops and multiple edges are automatically removed!
@param graph @param forceConnected if true an unconnected graph is made connected @param forceSimple if true a non - simple graph is made simple Calculates one spanning tree of graph which doesn ' t have to be but can be minimal ( this is faster than minimal spanning tree so if you need any spanning tree use this one ) Self loops and multiple edges are automatically removed!