mockers
Would you like to react to this message? Create an account in a few clicks or log in to continue.

No. of paths bw 2 nodes

3 posters

Go down

No. of paths bw 2 nodes Empty No. of paths bw 2 nodes

Post  shivang Mon Feb 02, 2009 9:39 am

Given a directed acyclic graph....find the no of paths between two given nodes?/
shivang
shivang

Posts : 42
Join date : 2009-01-30
Age : 35

Back to top Go down

No. of paths bw 2 nodes Empty No. of paths bw 2 nodes

Post  obama Sun Mar 01, 2009 10:57 am

i think we can use dfs.....
move forward until u get the destination .....
count no of such paths.......

obama

Posts : 4
Join date : 2009-02-03

Back to top Go down

No. of paths bw 2 nodes Empty @obama

Post  shivang Mon Mar 09, 2009 7:06 pm

you are approaching right....but dfs alone wont work....

think buddy Twisted Evil
shivang
shivang

Posts : 42
Join date : 2009-01-30
Age : 35

Back to top Go down

No. of paths bw 2 nodes Empty Re: No. of paths bw 2 nodes

Post  Beagle Tue Mar 10, 2009 10:49 am

firstly perform topological sort and then apply DFS b/w the given nodes.

That will give number of paths b/w two nodes.

If wrong then correct me?

Beagle

Posts : 40
Join date : 2009-01-30

Back to top Go down

No. of paths bw 2 nodes Empty @beagle

Post  shivang Tue Mar 10, 2009 10:22 pm

topological sort tak to thik hai...
uske aage aur dimaag laga...

only dfs se kaam nahi chalega...

we hav done this ques..yaad ho to.. Very Happy geek
shivang
shivang

Posts : 42
Join date : 2009-01-30
Age : 35

Back to top Go down

No. of paths bw 2 nodes Empty Re: No. of paths bw 2 nodes

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum