Having imported the data the next step was to write a cypher query which would give me the people in an adjacency matrix with the number in each column/row intersection showing how many common groups that pair of people had.

I thought it'd be easier to build this query incrementally so I started out writing a query which would return one row of the adjacency matrix:

I get back the same 10 people as Kieran Healy although they have different eigenvector values. As far as I understand the absolute value doesn't matter, what's more important is the relative score to other people so I think we're ok.

The final step was to write these eigenvector values back into neo4j which we can do with the following code:

Now we might use that eigenvector centrality value in other queries, such as one to show who the most central/potentially influential people are in each group:

MATCH g:Group<-[:MEMBER_OF]-p
WITH g.name AS group, p.name AS personName, p.eigenvectorCentrality as eigen
ORDER BY eigen DESC
WITH group, COLLECT(personName) AS people
RETURN group, HEAD(people) + [HEAD(TAIL(people))] + [HEAD(TAIL(TAIL(people)))] AS mostCentral

Our top ten feature frequently although it's interesting that only one of them is in the 'LongRoomClub' group which perhaps indicates that people in that group are less likely to be members of the other ones.

I'd be interested if anyone can think of other potential uses for eigenvector centrality once we've got it back in the graph.

All the code described in this post is on github if you want to take it for a spin.