/**
  * Initializes a new edge-weighted digraph that is a deep copy of <tt>G</tt> .
  *
  * @param G the edge-weighted graph to copy
  */
 public EdgeWeightedDigraph(EdgeWeightedDigraph G) {
   this(G.V());
   this.E = G.E();
   for (int v = 0; v < G.V(); v++) {
     // reverse so that adjacency list is in same order as original
     Stack<DirectedEdge> reverse = new Stack<DirectedEdge>();
     for (DirectedEdge e : G.adj[v]) {
       reverse.push(e);
     }
     for (DirectedEdge e : reverse) {
       adj[v].add(e);
     }
   }
 }