protected void sortVertices() { layerPartition = new DefaultLayerPartition(digraph, rankFunction, vertexShape, subgraphPartition); layerPartition.breadthFirstSort(); int crossingCount = layerPartition.countCrossings(); Map orderSnapshot = layerPartition.makeOrderSnapshot(); boolean lastIsBest = true; for (int i = 0; i < sortIterationCount; i++) { if (i % 2 == 0) layerPartition.sortDownByMedian(); else layerPartition.sortUpByMedian(); int newCrossingCount = layerPartition.countCrossings(); if (newCrossingCount < crossingCount) { crossingCount = newCrossingCount; orderSnapshot = layerPartition.makeOrderSnapshot(); lastIsBest = true; } else if (newCrossingCount > crossingCount) lastIsBest = false; } if (!lastIsBest) layerPartition.restoreOrder(orderSnapshot); layerPartition.refreshIndices(); }
protected void positionVertices() { layerPartition.setAlternatePendulumTraversals(false); layerPartition.setHorizontalSpacing(horizontalSpacing); layerPartition.setVerticalSpacing(verticalSpacing); layerPartition.setVerticalAlignment(verticalAligment); layerPartition.setRubberForceThreshold(1.0); layerPartition.createSubgraphPartition(); // layerPartition.printLayers(); layerPartition.positionDummies(); layerPartition.setDummyFixed(true); layerPartition.balancePendulum(100); layerPartition.balanceRubberBends(100); layerPartition.positionLayers(); layerPartition.updateGeometry(vertexShape, areaBounds); }
protected void positionArcs() { arcGeometry = layerPartition.positionArcs(); }