code: private boolean pathExists(T u, T v, boolean includeAdjacent) {
          if (!nodes.contains(u) || !nodes.contains(v)) {
              return false;
          }
          if (includeAdjacent && isAdjacent(u, v)) {
              return true;
          }
          Deque<T> stack = new LinkedList<>();
          Set<T> visited = new HashSet<>();
          stack.push(u);
          while (!stack.isEmpty()) {
              T node = stack.pop();
              if (node.equals(v)) {
                  return true;
              }
              if (!visited.contains(node)) {
                  visited.add(node);
                  edges.get(node).stream()
                       .filter(e -> includeAdjacent || !node.equals(u) || !e.equals(v))
                       .forEach(stack::push);
              }
          }
          assert !visited.contains(v);
          return false;
      }
docs: Returns true if there exists a path from u to v in this graph.
  If includeAdjacent is false, it returns true if there exists
  another path from u to v of distance > 1