Photo by Marc Babin on Unsplash

May 10: Cayman Islands, One Month Graph Challenge

Vlad Batushkov
May 10 · 3 min read

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.

Graph

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 www.caymanairways.com can offer me. I want IATA codes, please…

{"destinationsPerOrigin":{"CYB":["GCM","HAV","JFK","KIN","LCE","LYB","MBJ","MIA","ORD","RTB","TPA","DEN"],"GCM":["CYB","HAV","JFK","KIN","LCE","LYB","MBJ","MIA","ORD","RTB","TPA","DEN"],"HAV":["CYB","GCM","KIN","LCE","LYB","MBJ","MIA","RTB"],"JFK":["CYB","GCM","LYB","RTB"],"KIN":["CYB","GCM","HAV","JFK","LCE","LYB","MIA","ORD","RTB","TPA"],"LCE":["CYB","GCM","HAV","KIN","LYB","MIA"],"LYB":["CYB","GCM","HAV","JFK","KIN","LCE","MBJ","MIA","ORD","RTB","TPA","DEN"],"MBJ":["CYB","GCM","HAV","JFK","LCE","LYB","MIA","ORD","RTB","TPA"],"MIA":["CYB","GCM","HAV","KIN","LCE","LYB","RTB"],"ORD":["CYB","GCM","LYB"],"RTB":["CYB","GCM","KIN","LYB","MIA","TPA"],"TPA":["CYB","GCM","KIN","LYB","RTB"],"DEN":["GCM","CYB","LYB"]},"origins":["CYB","GCM","HAV","JFK","KIN","LCE","LYB","MBJ","MIA","ORD","RTB","TPA","DEN"]}

Left it here: https://vbatushkov.bitbucket.io/cayman.json

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.

Resume

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

Resources

Vlad Batushkov

Written by

Indie view on software development. Brewed with hops, web and rock’n’roll.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade