src/main/java/com/mxgraph/analysis/mxGraphStructure.java
public static void makeSimple(mxAnalysisGraph aGraph)
	{
		// remove all self-loops
		// reduce all valences >1 to 1
		mxGraph graph = aGraph.getGraph();
		Object parent = graph.getDefaultParent();

		Object[] edges = aGraph.getChildEdges(parent);
		//removing self-loops
		for (int i = 0; i < edges.length; i++)
		{
			Object currEdge = edges[i];

			if (aGraph.getTerminal(currEdge, true) == aGraph.getTerminal(currEdge, false))
			{
				graph.removeCells(new Object[] { currEdge });
			}
		}

		edges = graph.getChildEdges(parent);
		Set<Set<Object>> vertexSet = new HashSet<Set<Object>>();
		ArrayList<Object> duplicateEdges = new ArrayList<Object>();

		for (int i = 0; i < edges.length; i++)
		{
			Object currEdge = edges[i];
			Object source = aGraph.getTerminal(currEdge, true);
			Object target = aGraph.getTerminal(currEdge, false);
			Set<Object> currSet = new HashSet<Object>();
			currSet.add(source);
			currSet.add(target);

			if (vertexSet.contains(currSet))
			{
				//we have a duplicate edge
				duplicateEdges.add(currEdge);
			}
			else
			{
				vertexSet.add(currSet);
			}
		}

		Object[] duplEdges = duplicateEdges.toArray();

		graph.removeCells(duplEdges);
	}
/**
	 * @param graph
	 * Make a graph simple (remove parallel edges and self loops)
	 */
@param graph
Make a graph simple (remove parallel edges and self loops)
@param graph Make a graph simple ( remove parallel edges and self loops )
public static void makeSimple(mxAnalysisGraph aGraph)
	{
		mxGraph graph = aGraph.getGraph();
		Object parent = graph.getDefaultParent();
		Object[] edges = aGraph.getChildEdges(parent);
		for (int i = 0; i < edges.length; i++)
		{
			Object currEdge = edges[i];
			if (aGraph.getTerminal(currEdge, true) == aGraph.getTerminal(currEdge, false))
			{
				graph.removeCells(new Object[] { currEdge });
			}
		}
		edges = graph.getChildEdges(parent);
		Set<Set<Object>> vertexSet = new HashSet<Set<Object>>();
		ArrayList<Object> duplicateEdges = new ArrayList<Object>();
		for (int i = 0; i < edges.length; i++)
		{
			Object currEdge = edges[i];
			Object source = aGraph.getTerminal(currEdge, true);
			Object target = aGraph.getTerminal(currEdge, false);
			Set<Object> currSet = new HashSet<Object>();
			currSet.add(source);
			currSet.add(target);
			if (vertexSet.contains(currSet))
			{
				duplicateEdges.add(currEdge);
			}
			else
			{
				vertexSet.add(currSet);
			}
		}
		Object[] duplEdges = duplicateEdges.toArray();
		graph.removeCells(duplEdges);
	}
public static void makeSimple ( mxAnalysisGraph aGraph ) { mxGraph graph = aGraph . getGraph ( ) ; Object parent = graph . getDefaultParent ( ) ; Object [ ] edges = aGraph . getChildEdges ( parent ) ; for ( int i = 0 ; i < edges . length ; i ++ ) { Object currEdge = edges [ i ] ; if ( aGraph . getTerminal ( currEdge , true ) == aGraph . getTerminal ( currEdge , false ) ) { graph . removeCells ( new Object [ ] { currEdge } ) ; } } edges = graph . getChildEdges ( parent ) ; Set < Set < Object > > vertexSet = new HashSet < Set < Object > > ( ) ; ArrayList < Object > duplicateEdges = new ArrayList < Object > ( ) ; for ( int i = 0 ; i < edges . length ; i ++ ) { Object currEdge = edges [ i ] ; Object source = aGraph . getTerminal ( currEdge , true ) ; Object target = aGraph . getTerminal ( currEdge , false ) ; Set < Object > currSet = new HashSet < Object > ( ) ; currSet . add ( source ) ; currSet . add ( target ) ; if ( vertexSet . contains ( currSet ) ) { duplicateEdges . add ( currEdge ) ; } else { vertexSet . add ( currSet ) ; } } Object [ ] duplEdges = duplicateEdges . toArray ( ) ; graph . removeCells ( duplEdges ) ; }
@param graph
 Make a graph simple (remove parallel edges and self loops)
@param graph Make a graph simple ( remove parallel edges and self loops )
// remove all self-loops // reduce all valences >1 to 1 //removing self-loops //we have a duplicate edge