how to count friends in social network

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

how to count friends in social network

Post by itsmani1 »

HI
I want to count friends in a social network type system,
Like if A is friend of B and B is friend of C you can say A is connected with 2 peoples
now the thing is where there are so many users and they are connected with each other how to count them so that one user don't get repeats.
More importantly we also need to make sure if 50 user login at same time and server starts counting it don't gets down etc.

any idea or help?


thanks
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

I don't think the behavior you're asking for is desirable. Visualize it like a net: people are connected with other people, who are connected with others, etc. Eventually, everyone is connected, and thus everybody is everybody's friend. We have algorithms for searching these sorts of nets, let alone counting them...

Counting immediate friends, however, is simple.
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

Ok,
Thanks for the reply man.
can you suggest any of the scripts?
Post Reply