14.11 Higher-Order Neighbors
If we wish to create an object showing to neighbours, where \(i\) is a neighbour of \(j\), and \(j\) in turn is a neighbour of \(k\), so taking two steps on the neighbour graph, we can use nblag
(automatically removes \(i\) to \(i\) self-neighbours)
Returning to the graph representation of the same neighbour object, we can ask how many steps might be needed to traverse the graph?
## [1] 52
We step out from each observation across the graph to establish the number of steps needed to reach each other observation by the shortest path (creating an \(n \times n\) matrix sps
), once again finding the same maximum count.
## Warning: `shortest.paths()` was deprecated in igraph 2.0.0.
## ℹ Please use `distances()` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## [1] 52
The municipality with the maximum count is called Lutowiska, close to the Ukrainian border in the far south east of the country.
## [1] "Lutowiska"