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

Get R Data Analysis Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.