public void addEdge(DirectedEdge e) { int v = e.from(); int w = e.to(); validateVertex(v); validateVertex(w); adj[v].add(e); E++; }
public DoublyLinkedList<DirectedEdge> adjacent(int v) { validateVertex(v); return adj[v]; }
public Iterable<DirectedEdge> adj(int v) { validateVertex(v); return adj[v]; }