Untitled
protected List<E> visitDFPath(Vertex<E> v, Vertex<E> e, Set<Vertex<E>> visited, Set<E> blockedCells) { if (v.equals(e)) { List<E> path = new LinkedList<>(); path.add(e.getValue()); return path; } else { for (Vertex<E> neighbor : v.getNeighbors()) { if (!visited.contains(neighbor) && !blockedCells.contains(neighbor.getValue())) { visited.add(neighbor); List<E> path = visitDFPath(neighbor, e, visited, blockedCells); if (path != null) { path.add(0, v.getValue()); return path; } } } return null; } }