GraphGists

The Belgian Sitcom Graph: Who's Hot in "Thuis"

This gist is going to show you how you can query the elaborate landscape of relationships in Thuis. It is based on this picture by @pieter_vh. Very well done actually.

infografiekthuis

I took the picture and created a spreadsheet version of it - take a look over here. That allowed me to create the graph, which we will also setup in this Gist:

It looks like this:

Let’s take a look at the nodes that we have:

match (n)
return labels(n) as TypeOfNode, count(n) as NrOfNodes;

And then take a look at the interesting relationship patterns:

  • Female Gay characters

Let’s look at the same thing for the male characters:

  • Male Gay Characters

Strange that we have different numbers of gays, depending on whether they are male/female, right? And we can take that in any other direction that you would be interested in.

Let’s do two more queries:

Who is currently in a relationship but has not had any other relationships before

match (n)-[r:DOES]-(p)
where not((n)-[:DID]-())
return n.name as Name, n.gender as Gender
order by Name ASC;

or the opposite:

Who is currently NOT in a relationship but has had other relationships before

match (n)-[r:DID]-(p)
where not((n)-[:DOES]-())
return distinct n.name as Name, n.gender as Gender
order by Name ASC;

Pathfinding: how are two characters connected?

Let’s see how two characters are "connected"?

match (f:FEMALE {name:"Femke"}),(m:MALE {name:"Jean-Pierre"}),
p = AllShortestPaths(f-[*]-m)
return p;

You can click play and see the path in the console below:

I am sure there are many other things we could do with this - or a similar sitcom dataset. But that’s about enough for me :) …​