/**
  * Adds the directed edge <tt>e</tt> to the edge-weighted digraph.
  *
  * @param e the edge
  * @throws java.lang.IndexOutOfBoundsException unless endpoints of edge are between 0 and V-1
  */
 public void addEdge(DirectedEdge e) {
   int v = e.from();
   int w = e.to();
   validateVertex(v);
   validateVertex(w);
   adj[v].add(e);
   E++;
 }
 /**
  * Returns the number of directed edges incident from vertex <tt>v</tt>. This is known as the
  * <em>outdegree</em> of vertex <tt>v</tt>.
  *
  * @return the outdegree of vertex <tt>v</tt>
  * @param v the vertex
  * @throws java.lang.IndexOutOfBoundsException unless 0 <= v < V
  */
 public int outdegree(int v) {
   validateVertex(v);
   return adj[v].size();
 }
 /**
  * Returns the directed edges incident from vertex <tt>v</tt>.
  *
  * @return the directed edges incident from vertex <tt>v</tt> as an Iterable
  * @param v the vertex
  * @throws java.lang.IndexOutOfBoundsException unless 0 <= v < V
  */
 public Iterable<DirectedEdge> adj(int v) {
   validateVertex(v);
   return adj[v];
 }