The best solution is going to depend on properties of the graph. One solution not yet mentioned is to perform breadth first searches from both v and N (if it's a digraph, backward search from N) and report paths when some node appears in the current "wave" from both ends. If |V| >> the number of nodes we'd expect to visit, this will keep the number of nodes visited much lower than (roughly 2sqrt of) doing depth first search from v, enough to offset the additional memory requirements.
Bob H On Dec 17, 6:49 am, vicky <mehta...@gmail.com> wrote: > given a graph G(V,E) and a source vertex, v. no. of vetices n, and > edges e. you have to find all different paths from vertex v to some > vertex N, having exactly i(1<i<n) edges. v,N,i will be given by the > user. provide an algorithm for it. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.