private boolean nodesConnectedHelper(Node parent, Node from, Node to) {
    if (from == to)
      return true;
    for (Node n : from.adjNodes()) {
      if (n != parent && nodesConnectedHelper(from, n, to))
        return true;
    }
    return false;
  }