int (@NotNull GraphEdge edge, @NotNull GraphNode node) { NormalEdge normalEdge = asNormalEdge(edge); if (normalEdge == null) { return getLayoutIndex(getNotNullNodeIndex(edge)) - getLayoutIndex(node.getNodeIndex()); } int upEdgeLI = getLayoutIndex(normalEdge.up); int downEdgeLI = getLayoutIndex(normalEdge.down); int nodeLI = getLayoutIndex(node.getNodeIndex()); if (Math.max(upEdgeLI, downEdgeLI) != nodeLI) { return Math.max(upEdgeLI, downEdgeLI) - nodeLI; } else { return normalEdge.up - node.getNodeIndex(); } }