private V computeFarthestVertex(BreadthFirstIterator<V, E> bfs) { V farthest = null; int dist = Integer.MIN_VALUE; while (bfs.hasNext()) { V v = bfs.next(); int depth = bfs.getDepth(v); if (dist < depth) { farthest = v; dist = depth; } } return farthest; }