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;
 }
 protected int getIndex(Graph<V, E> graph, E e, V u, V v) {
   Collection<E> commonEdgeSet = new HashSet<E>(graph.getIncidentEdges(u));
   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;
 }
  public void step() {
    synchronized (vv.getGraphLayout()) {
      Graph<V, E> g = endLayout.getGraph();
      for (V v : g.getVertices()) {
        Point2D tp = transitionLayout.transform(v);
        if (tp == null) tp = new Point2D.Double(0, 0);
        Point2D fp = endLayout.transform(v);

        double dx = (fp.getX() - tp.getX()) / (count - counter);
        double dy = (fp.getY() - tp.getY()) / (count - counter);

        transitionLayout.setLocation(v, new Point2D.Double(tp.getX() + dx, tp.getY() + dy));
      }
      counter++;
      if (counter >= count) {
        done = true;
        // ((RelVisualizationModel)vv.getModel()).setRelaxer(relaxer);
        ((RelVisualizationModel) vv.getModel()).setAnimatorGraphLayout(endLayout);
      }
      vv.repaint();
    }
  }
 /**
  * Returns the index for the specified edge. Calculates the indices for <code>e</code> and for all
  * edges parallel to <code>e</code>.
  */
 public int getIndex(Graph<V, E> graph, E e) {
   Integer index = edge_index.get(e);
   if (index == null) {
     Pair<V> endpoints = graph.getEndpoints(e);
     V u = endpoints.getFirst();
     V v = endpoints.getSecond();
     if (u.equals(v)) {
       index = getIndex(graph, e, v);
     } else {
       index = getIndex(graph, e, u, v);
     }
   }
   return index.intValue();
 }
 /**
  * Resets the indices for this edge and its parallel edges. Should be invoked when an edge
  * parallel to <code>e</code> has been added or removed.
  *
  * @param e
  */
 public void reset(Graph<V, E> graph, E e) {
   Pair<V> endpoints = graph.getEndpoints(e);
   getIndex(graph, e, endpoints.getFirst());
   getIndex(graph, e, endpoints.getFirst(), endpoints.getSecond());
 }