@Override public V getNextVertex(V source, V target) { if (!containsEdge(source, target)) { throw new NoSuchElementException("Edge not found."); } V next = graph.getNextVertex(source, target); while (!vertices.contains(next)) { next = graph.getNextVertex(next, target); } return next; }