Photo by Marc Babin on Unsplash

Neo4j PageRank Algorithm and Path Pattern Matching on Flights Domain Model

May 10: Cayman Islands, One Month Graph Challenge

Welcome word

In this series of small posts I do one simple graph daily. Domain model of graph somehow related to day’s history, some historical event, celebration or person. I do this challenge to learn Neo4j Data Modeling and Cypher. Every day. One month. Follow me. Maybe you will be inspired and next month would be yours One Month Graph Challenge. #OMGChallenge

Domain model

In May 10, 1503, Christopher Columbus, the famous Spanish voyager and cartographer opened Cayman Islands on his last expedition to the “New World”. 516 years ago reach this lands was a miracle. Today I expect that airlines already covered a whole world, so visiting of this place — just a money question.

I plan to build a small graph of flight journey to Cayman Islands.


I living in Bangkok now, so anyway it would be a challenge. For sure, must be some list of destinations for big flights provider. Let’s check for Thai airlines, for example. As expected, first Google link is Wiki page with IATA codes — this is exactly what I am looking for. List all not terminated IATA codes:

Now I go to Cayman local flights provider and try to find how can I reach this place. Let’s see what can offer me. I want IATA codes, please…

Left it here:

Also as we have such connected graph lets apply to it pageRank algorithm and find the most “important” Airport here. Must be easy and fun. (Be sure, that only Cayman Airports included into calculation, easy way — is to clear the data).

PageRank decide that LYB is most important guy here. Ok. Let’s come back to the main goal: can I reach Cayman Island from Bangkok already?

Not yet… Ok. I think I need to find Japanese airlines to connect this 2 worlds. Wikipedia, hello, again. Let’s assume that HND is a hub of all flight directions.

As you can see Bangkok got connection to Tokyo and now finally with help of Japanese airlines my trip become possible.


Lack of the data make things harder than they are. Next time I with pleasure spend time on applying algorithms, than on hacking data and composing of data I need. If you know some wide connected flights graph between many cities across the world, please, share. It would gives me freedom to play with graph and paths finding.

Similar topics

Neo4j Random Walk Algorithm to Traverse Graph of Pubs

Unusual use of Neo4j Common Neighbors Algorithm on people community graph

Neo4j Betweenness Centrality Algorithm detailed and fun example

Neo4j kShortestPaths Algorithm apply to City Map

Neo4j Cosine Similarity Algorithm example

Analyse Neo4j Graph of Books domain model with Jaccard Similarity Algorithm