src/main/java/com/mxgraph/layout/hierarchical/model/mxGraphHierarchyModel.java
protected void createInternalCells(mxHierarchicalLayout layout,
			Object[] vertices, mxGraphHierarchyNode[] internalVertices)
	{
		mxGraph graph = layout.getGraph();

		// Create internal edges
		for (int i = 0; i < vertices.length; i++)
		{
			internalVertices[i] = new mxGraphHierarchyNode(vertices[i]);
			vertexMapper.put(vertices[i], internalVertices[i]);

			// If the layout is deterministic, order the cells
			Object[] conns = layout.getEdges(vertices[i]);
			List<Object> outgoingCells = Arrays.asList(graph.getOpposites(
					conns, vertices[i]));
			internalVertices[i].connectsAsSource = new LinkedHashSet<mxGraphHierarchyEdge>(
					outgoingCells.size());

			// Create internal edges, but don't do any rank assignment yet
			// First use the information from the greedy cycle remover to
			// invert the leftward edges internally
			Iterator<Object> iter = outgoingCells.iterator();

			while (iter.hasNext())
			{
				// Don't add self-loops
				Object cell = iter.next();

				if (cell != vertices[i] && graph.getModel().isVertex(cell)
						&& !layout.isVertexIgnored(cell))
				{
					// We process all edge between this source and its targets
					// If there are edges going both ways, we need to collect
					// them all into one internal edges to avoid looping problems
					// later. We assume this direction (source -> target) is the 
					// natural direction if at least half the edges are going in
					// that direction.

					// The check below for edgeMapper.get(edges[0]) == null is
					// in case we've processed this the other way around
					// (target -> source) and the number of edges in each direction
					// are the same. All the graph edges will have been assigned to
					// an internal edge going the other way, so we don't want to 
					// process them again
					Object[] undirectEdges = graph.getEdgesBetween(vertices[i],
							cell, false);
					Object[] directedEdges = graph.getEdgesBetween(vertices[i],
							cell, true);

					if (undirectEdges != null
							&& undirectEdges.length > 0
							&& (edgeMapper.get(undirectEdges[0]) == null)
							&& (directedEdges.length * 2 >= undirectEdges.length))
					{

						ArrayList<Object> listEdges = new ArrayList<Object>(
								undirectEdges.length);

						for (int j = 0; j < undirectEdges.length; j++)
						{
							listEdges.add(undirectEdges[j]);
						}

						mxGraphHierarchyEdge internalEdge = new mxGraphHierarchyEdge(
								listEdges);
						Iterator<Object> iter2 = listEdges.iterator();

						while (iter2.hasNext())
						{
							Object edge = iter2.next();
							edgeMapper.put(edge, internalEdge);

							// Resets all point on the edge and disables the edge style
							// without deleting it from the cell style
							graph.resetEdge(edge);

							if (layout.isDisableEdgeStyle())
							{
								layout.setEdgeStyleEnabled(edge, false);
								layout.setOrthogonalEdge(edge, true);
							}
						}

						internalEdge.source = internalVertices[i];
						internalVertices[i].connectsAsSource.add(internalEdge);
					}
				}
			}

			// Ensure temp variable is cleared from any previous use
			internalVertices[i].temp[0] = 0;
		}
	}
/**
	 * Creates all edges in the internal model
	 * 
	 * @param layout
	 *            reference to the layout algorithm
	 * @param vertices
	 *            the vertices whom are to have an internal representation
	 *            created
	 * @param internalVertices
	 *            the blank internal vertices to have their information filled
	 *            in using the real vertices
	 */
Creates all edges in the internal model

@param layout
reference to the layout algorithm
@param vertices
the vertices whom are to have an internal representation
created
@param internalVertices
the blank internal vertices to have their information filled
in using the real vertices
Creates all edges in the internal model @param layout reference to the layout algorithm @param vertices the vertices whom are to have an internal representation created @param internalVertices the blank internal vertices to have their information filled in using the real vertices
protected void createInternalCells(mxHierarchicalLayout layout,
			Object[] vertices, mxGraphHierarchyNode[] internalVertices)
	{
		mxGraph graph = layout.getGraph();
		for (int i = 0; i < vertices.length; i++)
		{
			internalVertices[i] = new mxGraphHierarchyNode(vertices[i]);
			vertexMapper.put(vertices[i], internalVertices[i]);
			Object[] conns = layout.getEdges(vertices[i]);
			List<Object> outgoingCells = Arrays.asList(graph.getOpposites(
					conns, vertices[i]));
			internalVertices[i].connectsAsSource = new LinkedHashSet<mxGraphHierarchyEdge>(
					outgoingCells.size());
			, but don't do any rank assignment yet
			Iterator<Object> iter = outgoingCells.iterator();
			while (iter.hasNext())
			{
				Object cell = iter.next();
				if (cell != vertices[i] && graph.getModel().isVertex(cell)
						&& !layout.isVertexIgnored(cell))
				{
					Object[] undirectEdges = graph.getEdgesBetween(vertices[i],
							cell, false);
					Object[] directedEdges = graph.getEdgesBetween(vertices[i],
							cell, true);
					if (undirectEdges != null
							&& undirectEdges.length > 0
							&& (edgeMapper.get(undirectEdges[0]) == null)
							&& (directedEdges.length * 2 >= undirectEdges.length))
					{
						ArrayList<Object> listEdges = new ArrayList<Object>(
								undirectEdges.length);
						for (int j = 0; j < undirectEdges.length; j++)
						{
							listEdges.add(undirectEdges[j]);
						}
						mxGraphHierarchyEdge internalEdge = new mxGraphHierarchyEdge(
								listEdges);
						Iterator<Object> iter2 = listEdges.iterator();
						while (iter2.hasNext())
						{
							Object edge = iter2.next();
							edgeMapper.put(edge, internalEdge);
							graph.resetEdge(edge);
							if (layout.isDisableEdgeStyle())
							{
								layout.setEdgeStyleEnabled(edge, false);
								layout.setOrthogonalEdge(edge, true);
							}
						}
						internalEdge.source = internalVertices[i];
						internalVertices[i].connectsAsSource.add(internalEdge);
					}
				}
			}
			internalVertices[i].temp[0] = 0;
		}
	}
protected void createInternalCells ( mxHierarchicalLayout layout , Object [ ] vertices , mxGraphHierarchyNode [ ] internalVertices ) { mxGraph graph = layout . getGraph ( ) ; for ( int i = 0 ; i < vertices . length ; i ++ ) { internalVertices [ i ] = new mxGraphHierarchyNode ( vertices [ i ] ) ; vertexMapper . put ( vertices [ i ] , internalVertices [ i ] ) ; Object [ ] conns = layout . getEdges ( vertices [ i ] ) ; List < Object > outgoingCells = Arrays . asList ( graph . getOpposites ( conns , vertices [ i ] ) ) ; internalVertices [ i ] . connectsAsSource = new LinkedHashSet < mxGraphHierarchyEdge > ( outgoingCells . size ( ) ) ; Iterator < Object > iter = outgoingCells . iterator ( ) ; while ( iter . hasNext ( ) ) { Object cell = iter . next ( ) ; if ( cell != vertices [ i ] && graph . getModel ( ) . isVertex ( cell ) && ! layout . isVertexIgnored ( cell ) ) { Object [ ] undirectEdges = graph . getEdgesBetween ( vertices [ i ] , cell , false ) ; Object [ ] directedEdges = graph . getEdgesBetween ( vertices [ i ] , cell , true ) ; if ( undirectEdges != null && undirectEdges . length > 0 && ( edgeMapper . get ( undirectEdges [ 0 ] ) == null ) && ( directedEdges . length * 2 >= undirectEdges . length ) ) { ArrayList < Object > listEdges = new ArrayList < Object > ( undirectEdges . length ) ; for ( int j = 0 ; j < undirectEdges . length ; j ++ ) { listEdges . add ( undirectEdges [ j ] ) ; } mxGraphHierarchyEdge internalEdge = new mxGraphHierarchyEdge ( listEdges ) ; Iterator < Object > iter2 = listEdges . iterator ( ) ; while ( iter2 . hasNext ( ) ) { Object edge = iter2 . next ( ) ; edgeMapper . put ( edge , internalEdge ) ; graph . resetEdge ( edge ) ; if ( layout . isDisableEdgeStyle ( ) ) { layout . setEdgeStyleEnabled ( edge , false ) ; layout . setOrthogonalEdge ( edge , true ) ; } } internalEdge . source = internalVertices [ i ] ; internalVertices [ i ] . connectsAsSource . add ( internalEdge ) ; } } } internalVertices [ i ] . temp [ 0 ] = 0 ; } }
Creates all edges in the internal model
Creates all edges in the internal model
// Create internal edges // If the layout is deterministic, order the cells // Create internal edges, but don't do any rank assignment yet // First use the information from the greedy cycle remover to // invert the leftward edges internally // Don't add self-loops // We process all edge between this source and its targets // If there are edges going both ways, we need to collect // them all into one internal edges to avoid looping problems // later. We assume this direction (source -> target) is the  // natural direction if at least half the edges are going in // that direction. // The check below for edgeMapper.get(edges[0]) == null is // in case we've processed this the other way around // (target -> source) and the number of edges in each direction // are the same. All the graph edges will have been assigned to // an internal edge going the other way, so we don't want to  // process them again // Resets all point on the edge and disables the edge style // without deleting it from the cell style // Ensure temp variable is cleared from any previous use