Currently i am working on a project where i need to match people based on the categories of food they like:
This is the scenario:
I have a list of USERS and their favorite foods in my database. The database structure is as follows:
USERS(id,name,email,gender,dob)
Fav_Food (id,user_name,food,desc)
Data for users table:
1, Alice, alice@lala.com, female, 11 Oct 2010
2, Bob, bob@lala.com, male, 12 Oct 2010
3, Jason, jason@lala.com, male, 13 Oct 2010
Data for fav_foods table:
1, Alice, apple, some desc
2, Alice, banana, some desc
3, Alice, Pear, some desc
4, Bob, apple, some desc
5, Bob, custard cake, some desc
6, Jason, banana,some desc
6,Jason,apple,some desc
Imagine that i am Alice where i like apple,banana & pear. How would i be able to match people based on the favorite food? For example, i first check if anyone likes apple,banana and pear (inclusive of all three) and than go with the permutation of only two combination (apple,banana)(apple,pear)(banana,pear)(banana,apple)
....and so on.....
Imagine it like a Venn diagram where the interaction is what i am interested. I am interested to suggest users with the most matched. Is there any algorithm available that i can use for php?