Farness and Closeness of a node

The farness of a node is defined as the total distance of this node from all the other nodes.

Closeness is the inverse of farness. Another way of looking at it is that closeness is how long will it take to pass a message from a node to all other nodes.

The following snippet shows the closeness calculation using the igraph package:

> head(sort(closeness(usairport), decreasing = TRUE),10)

253 124 287 243 22 6 406 35
7.974528e-08 7.948313e-08 7.921478e-08 7.921051e-08 7.918423e-08 7.917715e-08 7.912412e-08 7.897597e-08
158 34
7.889165e-08 7.886183e-08

We have nested multiple functions, let us untangle them. First, we use the function closeness to get the closeness property for each vertex. We pass that output to sort function, and sort the results by decreasing order of closeness. Finally, we use the head function to pick the top 10 results from the sort output.

Having explored some of the properties of the graph, let us see an overview of some of the graph algorithms available in the igraph package.

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

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