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...