spatial_centrality | R Documentation |
These functions are a collection of centrality measures that are specific
for spatial networks, and form a spatial extension to
centrality measures
in tidygraph.
centrality_straightness(...)
... |
Additional arguments passed on to other functions. |
Just as with all centrality functions in tidygraph, these functions
are meant to be called inside tidygraph verbs such as
mutate
or filter
, where
the network that is currently being worked on is known and thus not needed
as an argument to the function. If you want to use an algorithm outside of
the tidygraph framework you can use with_graph
to
set the context temporarily while the algorithm is being evaluated.
A numeric vector of the same length as the number of nodes in the network.
centrality_straightness()
: The straightness centrality of node i is the
average ratio of Euclidean distance and network distance between node i and
all other nodes in the network. ...
is forwarded to
st_network_distance
to compute the network distance matrix.
Euclidean distances are computed using st_distance
.
library(tidygraph, quietly = TRUE)
net = as_sfnetwork(roxel, directed = FALSE)
net |>
activate(nodes) |>
mutate(sc = centrality_straightness())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.