private void computeArcSlots(Digraph<SugiyamaNode<V>,SugiyamaArc<V,E>> graph) {
		List<SugiyamaArc<V,E>> arcs = new ArrayList<SugiyamaArc<V,E>>(graph.getEdgeCount());

		// collect arcs
		for (SugiyamaNode<V> source : graph.vertices()) {
			for (SugiyamaNode<V> target : graph.targets(source)) {
				arcs.add(graph.get(source, target));
			}
		}

		// sort arcs
		Collections.sort(arcs, new Comparator<SugiyamaArc<V,E>>() {
			@Override
			public int compare(SugiyamaArc<V,E> e1, SugiyamaArc<V,E> e2) {
				double key1 = e1.getSource().getIndex() + e1.getTarget().getIndex();
				double key2 = e2.getSource().getIndex() + e2.getTarget().getIndex();
				return key1 < key2 ? -1 : key1 > key2 ? 1 : 0;
			}
		});

		// assign slot numbers
		for (SugiyamaArc<V,E> arc : arcs) {
			arc.setSourceSlot(arc.getSource().nextLowerSlot());
			arc.setTargetSlot(arc.getTarget().nextUpperSlot());
			if ((int)arc.getSource().getPosition() == (int)arc.getTarget().getPosition()) { // assign center slot
				arc.getSource().setLowerCenterSlot(arc.getSourceSlot());
				arc.getTarget().setUpperCenterSlot(arc.getTargetSlot());
			}
			arc = arc.getBackArc();
			if (arc != null) {
				arc.setSourceSlot(arc.getSource().nextLowerSlot());
				arc.setTargetSlot(arc.getTarget().nextUpperSlot());
			}
		}
	}