Understanding vertex degrees

Within the context of graph theory, the degrees around a vertex are the number of edges around the vertex. In our flights example, the degrees are then the total number of edges (that is, flights) to the vertex (that is, airports). Therefore, if we were to obtain the top 20 vertex degrees (in descending order) from our graph, then we would be asking for the top 20 busiest airports (most flights in and out) from our graph. This can be quickly determined using the following query:

display(tripGraph.degrees.sort(desc("degree")).limit(20))

Because we're using the display command, we can quickly view a bar graph of this data:

Understanding vertex degrees

Diving into more details, here are the top 20 inDegrees (that is, incoming flights):

display(tripGraph.inDegrees.sort(desc("inDegree")).limit(20))
Understanding vertex degrees

While here are the top 20 outDegrees (that is, outgoing flights):

display(tripGraph.outDegrees.sort(desc("outDegree")).limit(20))
Understanding vertex degrees

Interestingly, while the top 10 airports (Atlanta/ATL to Charlotte/CLT) are ranked the same for incoming and outgoing flights, the ranks of the next 10 airports change (for example, Seattle/SEA is 17th for incoming flights, but 18th for outgoing).

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

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