GraphGists

Introduction

As an introduction I used open source data of International Flights Going All over the World. The data is very huge & complex but I was inspired when I looked at thedata & its graph model. Although I have made many changes to bring it in this form & now it become completely new & in workable form. The graph shows that in recent years the flights between all the countries & cities are connected with each other but on the other hand Airlines & Flights in all over the world has increased. The way to understand the differences between airlines & flights are to look at how people of different countries are traveling to different countries & cities for work or meetings & etc.

By using the available data, I have created the graph model outlined below. Each Flight & Airport is represented by a node. The label on the node is showing the info about the same. This example only includes flights between the airlines countries & cities so I can see so many connections.

The purpose of this exercise is to learn & how to use the graph database neo4j and some technical tools & concepts by using neo4j Countries and cities plus Airline & flights. These are the specific problems in traveling which I need to solve.

ydftT5g

Setup

Retrieve All Countries.

MATCH (country:Country) return country.countryName ORDER BY country.countryName

Retrieve All Cities.

MATCH (city:City) return city.cityName ORDER BY city.cityName

Retrieve All Airports.

MATCH (airport:Airport) return airport.airportName ORDER BY airport.airportName

Retrieve All Airlines.

MATCH (airline:Airline) return airline.airlineName ORDER BY airline.airlineName

Top 2 Most Busiest Aiports.

MATCH (airport:Airport)<-[r]-(f:Flight)  WITH airport, count(r) AS flight_count order by flight_count desc  return  airport.airportName  , flight_count limit 2

Top 2 Most Busiest Cities (Most Flights).

MATCH (city1:City)<-[:IS_IN]- (airport1:Airport)<-[r]-(flight1:Flight) WITH city1, count(DISTINCT flight1) as flight_count order by flight_count desc return city1.cityName,flight_count limit 2

Top 2 Airlines with Most Flights.

MATCH (airline:Airline)<-[r]-(f:Flight)  WITH airline, count(r) AS flight_count order by flight_count desc  return airline.airlineName, flight_count limit 2

Top 2 Cities with Most Airports.

MATCH (city:City)<-[r]-(airport:Airport)  WITH city, count(r) AS airport_count order by airport_count desc  return city.cityName, airport_count limit 2

Top 2 Countries with Most Airlines.

MATCH (country:Country )<-[:BELONGS_TO]-(airline:Airline)  WITH country,count(DISTINCT airline) as airline_count order by airline_count desc  return  country.countryName,airline_count limit 2

Conclusions

Conclusion: This exercise gives us the ways what is the best to go from point-A to point-B & tells is there an alternative or not & shortcuts, long route & many stops in between which helps to make things as per what the person or treveler needs to do & helps his traveling needs, also tells which way is the fastest or the longest. This solution helps the person able to do whatever he wants to do.