For people who doesn’t know, Eurovision is a song contest amongs European countries. The particularity is that countries must vote to each other to determine the winner.


But, it’s always the same impression each year : Sounds like there is countries that works in gang. Can we somehow reveal this feeling with a little help of Graph ? Let’s see :

The model is very simple


Here is the harvest of data that represents all the Eurovision votes in the 2012, 2013, 2014 and 2015 final session.

Comment : a Voting Country can also be a Candidate Country.

For people that notices "Autralia", it’s not a typo with "Austria", Australia did participate to Eurovision as candidate in 2015.

Who participated, which year was it and as candidate or voter ?

Let’s start simple by checking who participated at which final and who was only voting.

MATCH (country)-[v:VOTE]->()
WITH country, count(DISTINCT v.year) AS nb_voting ,collect(DISTINCT v.year) AS year_voting
MATCH ()-[p:VOTE]->(country)
WITH country, nb_voting,year_voting, count(DISTINCT p.year) AS nb_participation ,collect(DISTINCT p.year) AS year_participation
ORDER BY nb_participation DESC

Vote distribution visualization within a year

Quick graph to represent the vote distribution within a year (here 2015).

MATCH path = (voter:Country)-[v:VOTE]->(candidate:Country)
WHERE v.year = 2015 AND v.score >= 8

Best voter

Which voter always votes for the winner ?

MATCH (voter)-[vote:VOTE]->(country)
WHERE vote.score = 12 AND country.winner = "Yes"
WITH voter, COUNT(DISTINCT vote.year) AS nb_year , COLLECT(DISTINCT vote.year) AS years
WHERE nb_year = 4

If you need to bet, UK looks a very good advisor :-D

Impact of votes ?

If we just gives the 8, 10, 12 points, does it change the rank per year ?

MATCH ()-[up:VOTE]->(country)
WHERE up.score >= 8
WITH country, up.year as year, SUM(up.score) AS up_score
MATCH ()-[all:VOTE]->(country)
WHERE all.year = year
WITH country, year, up_score , SUM(all.score) as all_score
RETURN,year, all_score,up_score
ORDER BY year,all_score DESC

So, sounds like the votes under 8 points doesn’t really influence the rank. Maybe some place are switch in the top 5, but no drastic change.

Diversity in votes

As we saw previously, the most important points given are the famous 8, 10 and 12. How theses votes are distributed per country each year ?

Let’s see how many different candidates a country voted for.

MATCH (a)-[e:VOTE]->(b)
WHERE e.score >= 8
WITH a, count(DISTINCT e.year) AS years, collect(DISTINCT AS candidate, count(DISTINCT AS nb_candidate,toFloat(count(DISTINCT toFloat(count(DISTINCT e.year)*3) AS ratio
WHERE ratio <> 1


MATCH (voter)-[e:VOTE]->(candidate)
WHERE e.score >= 8
WITH voter, candidate, collect(DISTINCT e.year) AS years, COUNT(DISTINCT e.year) as nb_year
ORDER BY nb_year DESC,

The ratio shows how "diverse" the votes of a country was during the 4 sessions. Most of countries almost voted different countries each time. But a few of them doesn’t have this variety of votes, and they almost votes the same candidate.


MATCH w WHERE w.winner = "Yes" REMOVE w:Country SET w:Winner;
MATCH (a)-[e:VOTE]->(b)
WHERE e.score >= 8
WITH a,b, count(DISTINCT e.year) AS years
WHERE years >= 2
CREATE p= (a)-[r:SIMILAR_VOTE {nb:years}]->(b)


12 points go to …​ Foaf:

In this query, we will try to check the mutual votes per year where the score of both votes is up to 8.

MATCH (a)-[e:VOTE]->(b),(b)-[f:VOTE]->(a)
WHERE f.year = e.year AND e.score >= 8 AND f.score >= 8
ORDER BY e.year,

This result is quite detailed, we can simplify by agregating by years.

MATCH (a)-[e:VOTE]->(b), (b)-[f:VOTE]->(a)
WHERE f.year = e.year AND e.score >= 8 AND f.score >= 8
WITH a,b,collect(DISTINCT e.year) as years,count(DISTINCT e.year) as nb_years
ORDER BY nb_years DESC

It’s interesting to see that there is actually countries that are mutualing voting to each other, and for some, it appears 2 times on 4 years.

Graph of Friends

Let’s visualize the last result

MATCH w WHERE w.winner = "Yes" REMOVE w:Country SET w:Winner;
MATCH p = (a)-[e:VOTE]->(b), q = (b)-[f:VOTE]->(a)
WHERE f.year = e.year AND e.score >= 8 AND f.score >= 8


Interesting, some winner sounds like part of a cluster of countries. But as they are winner, they automatically behave like 'hub' in the graph. Let’s do the same graph without them.

MATCH p = (a)-[e:VOTE]->(b), q = (b)-[f:VOTE]->(a)
WHERE f.year = e.year AND e.score >= 8 AND f.score >= 8 AND a.winner <> "Yes" AND b.winner <> "Yes"


With or without the winner candidates, the result is same : it almost looks like the World Border Graph. So it sounds like some countries are part of a "geographical gang".


For sure, the investigation can be improved by more data and analysed more in details.

We can’t conclude surely that countries are organised in "gang", but we can observe some interesting singularities and distinguish some cluster of country based on geographical location.