I am trying to work on android mobile app where I have a functionality to find matches according to interest and location. Many dating apps are already doing some kinda functionality for example Tinder matches based on locations, gender and age etc.
I do not want to reinvent the wheel if it has been done already. I have searched on google and some suggested to use clustering algorithm for this Algorithm for clustering people with similar interests User similarities algorithm
Lets I have data in this JSON format for users
User1: {location: "Delhi, India", interests: ["Jogging", "Travelling", "Praying"] }
User2: {location: "Noida, India", interests: ["Running", "Eating", "Praying"] }
User3: {location: "Bangalore, India", interests: ["Exercise", "Visiting new places", "Chanting"] }
I am writing a matching algorithm that matches few below criteria -
If user1 is having an interest in "Jogging" and another user2 is having an interest in "Running" so as jogging and running is alternatively a kind of exercise so they should match both the profiles as well as it should be location wise also as nearest should be on top.
The algorithm, when running at scale, should be fairly performant. This means I'd like to avoid comparing each user individually to each other user. For N users this is an O(N^2) operation. Ideally, I'd like to develop some sort of "score" that I can generate for each user in isolation since this involves looping through all users only once. Then I can find other users with similar scores and determine the best match based off that.
Can anyone suggest me with some implementation of how can I achieve this with the help of firebase-cloud-function
and firebase-database
.