code: public static <N, E> List<N> toNodeList(List<E> edgeList, Graph<N, E> graph, N init) {
          List<N> result = new ArrayList<>(edgeList.size() + 1);
          result.add(init);
  
          for (E edge : edgeList) {
              N tgt = graph.getTarget(edge);
              result.add(tgt);
          }
  
          return result;
      }
docs: Converts a list of edges into a corresponding list of nodes. Note that the list of nodes is always one larger
  than the respective list of edges.
  
  @param edgeList
  the list of edges
  @param graph
  the graph
  @param init
  the initial node
  
  @return the node list corresponding to the given edge list.