Source:
<code>public int routeEdges(final IElkProgressMonitor monitor, final LGraph layeredGraph, final Iterable<LNode> sourceLayerNodes, final int sourceLayerIndex, final Iterable<LNode> targetLayerNodes, final double startPos) { Random random = layeredGraph.getProperty(InternalProperties.RANDOM); Map<LPort, HyperEdgeSegment> portToEdgeSegmentMap = Maps.newHashMap(); List<HyperEdgeSegment> edgeSegments = Lists.newArrayList(); createHyperEdgeSegments( sourceLayerNodes, routingStrategy.getSourcePortSide(), edgeSegments, portToEdgeSegmentMap); createHyperEdgeSegments( targetLayerNodes, routingStrategy.getTargetPortSide(), edgeSegments, portToEdgeSegmentMap); criticalConflictThreshold = CRITICAL_CONFLICT_THRESHOLD_FACTOR * minimumHorizontalSegmentDistance(edgeSegments); int criticalDependencyCount = 0; for (int firstIdx = 0; firstIdx < edgeSegments.size() - 1; firstIdx++) { HyperEdgeSegment firstSegment = edgeSegments.get(firstIdx); for (int secondIdx = firstIdx + 1; secondIdx < edgeSegments.size(); secondIdx++) { criticalDependencyCount += createDependencyIfNecessary(firstSegment, edgeSegments.get(secondIdx)); } } if (debugPrefix != null && monitor.isLoggingEnabled()) { DebugUtil.logDebugGraph( monitor, layeredGraph, sourceLayerNodes == null ? 0 : sourceLayerIndex + 1, edgeSegments, debugPrefix, sourceLayerIndex + "-full"); } if (criticalDependencyCount >= 2) { breakCriticalCycles(edgeSegments, random); } breakNonCriticalCycles(edgeSegments, random); if (debugPrefix != null && monitor.isLoggingEnabled()) { DebugUtil.logDebugGraph( monitor, layeredGraph, sourceLayerNodes == null ? 0 : sourceLayerIndex + 1, edgeSegments, debugPrefix, sourceLayerIndex + "-acyclic"); } <START> <END> topologicalNumbering(edgeSegments); int rankCount = -1; for (HyperEdgeSegment node : edgeSegments) { if (Math.abs(node.getStartCoordinate() - node.getEndCoordinate()) < TOLERANCE) { continue; } rankCount = Math.max(rankCount, node.getRoutingSlot()); routingStrategy.calculateBendPoints(node, startPos, edgeSpacing); } routingStrategy.clearCreatedJunctionPoints(); return rankCount + 1; }</code><technical_language>Additional whitespace</technical_language>

Target:
public int routeEdges(final IElkProgressMonitor monitor, final LGraph layeredGraph, final Iterable<LNode> sourceLayerNodes, final int sourceLayerIndex, final Iterable<LNode> targetLayerNodes, final double startPos) { Map<LPort, HyperEdgeSegment> portToEdgeSegmentMap = Maps.newHashMap(); List<HyperEdgeSegment> edgeSegments = Lists.newArrayList(); createHyperEdgeSegments( sourceLayerNodes, routingStrategy.getSourcePortSide(), edgeSegments, portToEdgeSegmentMap); createHyperEdgeSegments( targetLayerNodes, routingStrategy.getTargetPortSide(), edgeSegments, portToEdgeSegmentMap); criticalConflictThreshold = CRITICAL_CONFLICT_THRESHOLD_FACTOR * minimumHorizontalSegmentDistance(edgeSegments); int criticalDependencyCount = 0; for (int firstIdx = 0; firstIdx < edgeSegments.size() - 1; firstIdx++) { HyperEdgeSegment firstSegment = edgeSegments.get(firstIdx); for (int secondIdx = firstIdx + 1; secondIdx < edgeSegments.size(); secondIdx++) { criticalDependencyCount += createDependencyIfNecessary(firstSegment, edgeSegments.get(secondIdx)); } } if (debugPrefix != null && monitor.isLoggingEnabled()) { DebugUtil.logDebugGraph( monitor, layeredGraph, sourceLayerNodes == null ? 0 : sourceLayerIndex + 1, edgeSegments, debugPrefix, sourceLayerIndex + "-full"); } Random random = layeredGraph.getProperty(InternalProperties.RANDOM); if (criticalDependencyCount >= 2) { breakCriticalCycles(edgeSegments, random); } breakNonCriticalCycles(edgeSegments, random); if (debugPrefix != null && monitor.isLoggingEnabled()) { DebugUtil.logDebugGraph( monitor, layeredGraph, sourceLayerNodes == null ? 0 : sourceLayerIndex + 1, edgeSegments, debugPrefix, sourceLayerIndex + "-acyclic"); } topologicalNumbering(edgeSegments); int rankCount = -1; for (HyperEdgeSegment node : edgeSegments) { if (Math.abs(node.getStartCoordinate() - node.getEndCoordinate()) < TOLERANCE) { continue; } rankCount = Math.max(rankCount, node.getRoutingSlot()); routingStrategy.calculateBendPoints(node, startPos, edgeSpacing); } routingStrategy.clearCreatedJunctionPoints(); return rankCount + 1; }