November 2017
Beginner to intermediate
366 pages
7h 59m
English
The centrality of a vertex in a graph defines the importance of that vertex in the graph. Centrality can be calculated in a multitude of ways. Degree centrality is calculated based on the in-degree--the number of incoming edges--and the out-degree--the number of outgoing edges of the graph.
Let's look at the code to find the degree centrality:
> degrees <- degree(usairport, loops = FALSE)> head(sort(degrees, decreasing = TRUE),10) 0 1 2 6 5 17 7 20 10 9 145 136 132 130 122 114 114 110 109 98
In the preceding case, we use the degree function to find the degree centrality score. We have sorted it in descending order. Airport 0 has the highest centrality score. In this case, we have used both the in-degree and the out-degree. ...
Read now
Unlock full access