try using dynamic programming approach k length path from v = k-1 length subproblem from all of v's neighbours.
(and yes you will have to keep some pointers to ensure that it remains a path (if u want simple path). -Rohit On Sun, Dec 27, 2009 at 8:35 AM, me13013 <[email protected]> wrote: > 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 <[email protected]> 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
