GraphGists

With the UEFA Euro 2016 ahead of us let’s see which football club could have more players taking part of the championship.

MATCH (a)-[r]->(b) WHERE labels(a) <> [] AND labels(b) <> []
RETURN DISTINCT head(labels(a)) AS This, type(r) as To, head(labels(b)) AS That LIMIT 10
qcMEiir

Using the current dataset we can easily get the top 10 clubs with the most players being called by their national teams.

MATCH (c:Club)<-[PLAYS_FOR]-(Player)
RETURN c.name AS Club, count(*) AS Internationals
ORDER BY Internationals DESC LIMIT 10;

Manchester United is on the top three with 13 international players and we can get to see who are these players and where do they come from.

MATCH (c:Club)<-[PLAYS_FOR]-(p:Player)-[REPRESENTS]->(n:NationalTeam)
WHERE c.name='Manchester United'
RETURN n.name AS Country, count(*) AS Count, collect(p.name) AS Internationals
ORDER BY Count DESC;

But we can also check in which clubs are playing the members of a given national team.

MATCH (c:Club)<-[PLAYS_FOR]-(p:Player)-[REPRESENTS]->(n:NationalTeam)
WHERE n.name='Spain'
RETURN c.name AS Club, count(*) AS Count, collect(p.name) AS Internationals
ORDER BY Count DESC;

This lead us to ask: what country needs to pick from less clubs to build their team?

MATCH (c:Club)<-[PLAYS_FOR]-(Player)-[REPRESENTS]->(n:NationalTeam)
RETURN n.name AS Country, count(DISTINCT c) AS Distinct_Teams
ORDER BY Distinct_Teams;

Concluding that English players seem to know each other better as they are used to play together for the same teams during the year.