Building a Dating site with Neo4j – Part One

You might have already heard that Facebook is getting into the Dating business. Other dating sites have been using graphs in the past and we’ve looked at finding love using the graph before. It has been a while though, so let’s return to the topic making use of the new Date and Geospatial capabilities of Neo4j 3.4. I have to warn you though that I’ve been with Helene for almost 15 years and missed out on all this dating site fun, what I do know I blame Colin for it and some pointers from the comments section of this blog post.

Dating sites face a series of challenges, the first one is lack of users. Only two ways to fix that, the first one involves having lots of money to pay for national advertisements, the second involves word of mouth. So you dear reader have to either invest a few million dollars or join our new dating site and tell all your friends about it.

The second challenge is matching people together. Sure looks are important, but we can’t all be “5/7” or look like Seven of Nine. We want to find people who share common values, both in terms of the things they love and hate. Sometimes though, it is opposites that attract. So we’ll need a ranking system, but also the ability to flip it around and see who else is out there.

The third challenge dating sites face is messages. More specifically crude overtly sexual messages from desperate uglies to every profile. To fix this, some sites only let paying members send messages, which isn’t super effective. Other sites have decided that only women may send messages. We’re going to try something different. More on that in a bit.

The fourth challenge is getting people to keep coming back to the dating site and staying there. We’re going to combine the last two problems and try to solve them together. Dating sites can’t use the “swipe right/left” gimmick anymore, so we will try some new things in our dating site. We are going to to give users the ability to “appear” in front of potential mates more than once, and to be able to make a different impression each time. So instead of focusing on profiles alone, we want our users to create content (words or pictures) to attract mates. We will let users “high five” content they like, which will allow the person who posted that content to contact the “high fiver”. But we want to instill a sense of urgency in making contact, so the “high fives” will expire after 5 days, and to avoid people spamming “high fives”, users will start with 5 “high fives” a day, and earn a “high five” every time they get a “high five”.

The fifth challenge is really really really ridiculously good looking people getting all the attention and making the “normies” feel like “uglies”. So we’ll balance things out by allowing people to “low five” content they don’t like. Specially the pretty pictures of their rivals. When a post gets a “low five”, part of it will be hidden. The more “low fives” it gets, the less of it will be shown. For example:

To avoid too much hate, a user will also start with only 5 “low fives” a day, and earn more for every “low five” they get. These “low fives” will also expire after 5 days. All this high and low fiving is just for fun, bottom line is people just want interact with people who message back and talk about making a date.

Alright, that’s plenty of introduction. Let’s start with an initial data model of user interactions.

The things to note are the “Date” type properties in Message, and the HIGH_FIVE, LOW_FIVE relationships. We are still going to use the “dated relationship” trick for Posts, and we will borrow the geospatial data model of a previous post. These are my initial thoughts and subject to change, we’ll see as we build this application together. What would you like to see in a dating site? If you have any suggestions, please leave a comment below.

Code is still very much in progress, but if you want to see what I have so far, take a sneak peak at this github repository. I’ll walk through the interesting bigs in the next set of blog posts.

Tagged , , , , , , , , , ,

6 thoughts on “Building a Dating site with Neo4j – Part One

  1. leonid levin says:

    Hi, Max. How about beefing up the “unlike” functionality: if a user has rejected a message/advance once the user who wants to insist on making a connection should receive some sort of a negative weight which will accumulate. Let’s say a “3 attempts” threshold should be established before the “insisting” user get automatically blocked from sending a message to his/her subject of desire

    • maxdemarzi says:

      The person who wrote the post chooses to initiate the conversation. If the conversation goes badly, the initiator can block the other person permanently. After the 5 days pass, the HIGH_FIVE is gone and so is the conversation… If they don’t block them, all they can do is get a HIGH FIVE from them, no messages allowed unless the initiator starts the conversation.

  2. […] Blog post series: Building a Dating Site […]

  3. Pardeep Kumar says:

    Nice post. I have a very basic question though:
    How do we get list of users in a given radius ? Say, user wants to find out all the users in a 2 Kilometers radius around him ?

    • maxdemarzi says:

      You can use Zip code to be more granular than City, but DO NO save user specific lat/lon coordinates as these can be used to find out exactly where someone lives/is and can be abused by stalkers.

  4. […] we came up with. I won’t explain it in-depth, but if you’re really bored, I wrote a 12-part series on how to build a dating site that follows a slightly different model in which people talk to each […]

Leave a comment