protected int getIndex(Graph<V, E> graph, E e, V v) { Collection<E> commonEdgeSet = new HashSet<E>(); for (E another : graph.getIncidentEdges(v)) { V u = graph.getOpposite(v, another); if (u.equals(v)) { commonEdgeSet.add(another); } } int count = 0; for (E other : commonEdgeSet) { if (e.equals(other) == false) { edge_index.put(other, count); count++; } } edge_index.put(e, count); return count; }