Then I will go with Atul's solution. BFS should work. Consider the graph
with nodes representing as people and edges to be the "friendship"
association. For any i,j pair you need to look for the paths of length 2
from one node to another. For finding it out for all the pairs, it will
have to be done it explicitly since computation for each pair is
independent of other pairs. Since, there is no limitation on the degree as
well, i don't see an advantage in reducing the problem to other graph
problems as well.


On Thu, Jan 19, 2012 at 5:20 PM, WgpShashank <shashank7andr...@gmail.com>wrote:

> @Ayush ..Mutual Friends Means common friends between  you & person you are
> viewing profile . e.g. Mutual friends are the people who are  friends with
> both you and the person whose profile you are viewing. For instance, if you
> are friends with shashank, and Mark is friends with Shashank, then Shashank
> will be shown as a mutual friend when you are viewing Mark's profile.
>
>
> and here we are interested in finding the all the mutual friends between
> all i,j pairs , imagine n*m , n,m are very large , its huge social graph.
>
> for simplicity pint of view try with two users then we can discuss & think
> about more solution for all such i,j pairs .
>
> hope problem is clear now ?
>
>
>
>
> Thanks
> Shashank Mani Narayan
> Computer Science
> BIrla Institute of Technology Mesra
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/u0fSaAo7HMUJ.
>
> To post to this group, send email to algogeeks@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.
>

-- 
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 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.

Reply via email to