code: private List<Long> getPathToNode(Node endNode) {
          List<Long> path = new ArrayList<>();
          // Reverse the path.
          Node curNode = endNode;
          do {
              path.add(0, curNode.id);
              curNode = m_nodePool.getNodeAtIdx(curNode.pidx);
          } while (curNode != null);
  
          return path;
      }
docs: Gets the path leading to the specified end node.