No. of paths bw 2 nodes
3 posters
Page 1 of 1
No. of paths bw 2 nodes
Given a directed acyclic graph....find the no of paths between two given nodes?/
shivang- Posts : 42
Join date : 2009-01-30
Age : 35
No. of paths bw 2 nodes
i think we can use dfs.....
move forward until u get the destination .....
count no of such paths.......
move forward until u get the destination .....
count no of such paths.......
obama- Posts : 4
Join date : 2009-02-03
@obama
you are approaching right....but dfs alone wont work....
think buddy
think buddy
shivang- Posts : 42
Join date : 2009-01-30
Age : 35
Re: No. of paths bw 2 nodes
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?
That will give number of paths b/w two nodes.
If wrong then correct me?
Beagle- Posts : 40
Join date : 2009-01-30
@beagle
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..
uske aage aur dimaag laga...
only dfs se kaam nahi chalega...
we hav done this ques..yaad ho to..
shivang- Posts : 42
Join date : 2009-01-30
Age : 35
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|