Re: [algogeeks] Re: Finding connection b/w 2 profiles

2011-10-29 Thread praveen raj
@jitesh rightly said... since there is no limit of depth... we can go for BFS.. we can reduce space by comparing A's and C's profile... whatever is common ... we can use it to find connection... between A and C With regards, Praveen Raj DCE-IT 3rd yr 735993 praveen0...@gmail.com

Re: [algogeeks] Re: Finding connection b/w 2 profiles

2011-09-14 Thread JITESH KUMAR
Neither depth is known nor we have to find the shortest path. We just have to find the path. -- *Regards Jitesh Kumar * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To

Re: [algogeeks] Re: Finding connection b/w 2 profiles

2011-09-14 Thread Azhar Hussain
Union Find Algorithm would do - Azhar. On Wed, Sep 14, 2011 at 1:42 PM, JITESH KUMAR jkhas...@gmail.com wrote: Neither depth is known nor we have to find the shortest path. We just have to find the path. -- *Regards Jitesh Kumar * -- You received this message because you are

Re: [algogeeks] Re: Finding connection b/w 2 profiles

2011-09-14 Thread tech coder
we can also use dfs and find if there exist path between given two nodes(profiles here). if yea , there is a connection b/w two profiles. On Wed, Sep 14, 2011 at 1:58 PM, Azhar Hussain azhar...@gmail.com wrote: Union Find Algorithm would do - Azhar. On Wed, Sep 14, 2011 at 1:42 PM,

Re: [algogeeks] Re: Finding connection b/w 2 profiles

2011-09-14 Thread JITESH KUMAR
Using DFS we can stuck in the blind ally as there is not limit of depth.. On Wed, Sep 14, 2011 at 4:16 PM, tech coder techcoderonw...@gmail.comwrote: we can also use dfs and find if there exist path between given two nodes(profiles here). if yea , there is a connection b/w two profiles.

[algogeeks] Re: Finding connection b/w 2 profiles

2011-09-13 Thread Don
You could do a depth-first search limited to depth 2. If that fails, do it to depth 3. Then 4, etc. It is very space efficient, and you will be spending 99% of your time at the deepest level, so the time penalty compared to breadth first is not all that bad. Don On Sep 13, 9:57 am, JITESH KUMAR

[algogeeks] Re: Finding connection b/w 2 profiles

2011-09-13 Thread Don
I think your statement about A-B-C leads people to believe that the depth is 2. If we know depth is 2, we just scan A's friends and C's friends looking for a match, which is B. If we don't know the length of the path, we might want to start searching from A and C at the same time and look for a

[algogeeks] Re: Finding connection b/w 2 profiles

2011-09-13 Thread Navneet
A related discussion is available here. http://stackoverflow.com/questions/1556451/how-do-sites-like-linkedin-efficiently-display-1st-2nd-3rd-level-relationship-nex On Sep 13, 8:37 pm, Don dondod...@gmail.com wrote: I think your statement about A-B-C leads people to believe that the depth is 2.

Re: [algogeeks] Re: Finding connection b/w 2 profiles

2011-09-13 Thread saurabh agrawal
@DON: DFS should not be applied because, there can exist multiple paths from A to C, but the question is to find the shortest path. So, u might end up getting longer path. Otherwise you have to search for all possible paths which will be very inefficient. Saurabh Agrawal On Tue, Sep 13,