Determining the top transfer airports

An extension of understanding vertex degrees for airports is to determine the top transfer airports. Many airports are used as transfer points instead of being the final destination. An easy way to calculate this is by calculating the ratio of inDegrees (the number of flights to the airport) and / outDegrees (the number of flights leaving the airport). Values close to 1 may indicate many transfers, whereas values <1 indicate many outgoing flights and values >1 indicate many incoming flights.

Note that this is a simple calculation that does not consider timing or scheduling of flights, just the overall aggregate number within the dataset:

# Calculate the inDeg (flights into the airport) and 
# outDeg (flights leaving the airport)
inDeg = tripGraph.inDegrees
outDeg = tripGraph.outDegrees

# Calculate the degreeRatio (inDeg/outDeg)
degreeRatio = inDeg.join(outDeg, inDeg.id == outDeg.id) 
  .drop(outDeg.id) 
  .selectExpr("id", "double(inDegree)/double(outDegree) as degreeRatio") 
  .cache()

# Join back to the 'airports' DataFrame 
# (instead of registering temp table as above)
transferAirports = degreeRatio.join(airports, degreeRatio.id == airports.IATA) 
  .selectExpr("id", "city", "degreeRatio") 
  .filter("degreeRatio between 0.9 and 1.1")

# List out the top 10 transfer city airports
display(transferAirports.orderBy("degreeRatio").limit(10))

The output of this query is a bar chart of the top 10 transfer city airports (that is, hub airports):

Determining the top transfer airports

This makes sense since these airports are major hubs for national airlines (for example, Delta uses Minneapolis and Salt Lake City as its hub, Frontier uses Denver, American uses Dallas and Phoenix, United uses Houston, Chicago, and San Francisco, and Hawaiian Airlines uses Kahului and Honolulu as its hubs).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset