/** * Performs a depth-first search of this graph from a given starting * vertex. For each vertex that is reachable from the start, this * operation computes its distance from the start and its predecessor * on the search path. * @param start The start vertex */ public void depthFirstSearch(Vertex start) { DequeAdder headAdder = new DequeAdder() { public void add(Vertex vertex, Deque<Vertex> deque) { deque.addFirst(vertex); } }; search(start, headAdder); }