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 ; }
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 .