Skip to contents

These functions are a collection of centrality measures that are specific for spatial networks, and form a spatial extension to centrality measures in tidygraph.

Usage

centrality_straightness(...)

Arguments

...

Additional arguments passed on to other functions.

Value

A numeric vector of the same length as the number of nodes in the network.

Details

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.

Functions

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

Examples

library(tidygraph, quietly = TRUE)

net = as_sfnetwork(roxel, directed = FALSE)

net |>
  activate(nodes) |>
  mutate(sc = centrality_straightness())
#> # A sfnetwork: 987 nodes and 1215 edges
#> #
#> # An undirected multigraph with 9 components and spatially explicit edges
#> #
#> # Dimension: XY
#> # Bounding box: xmin: 7.522595 ymin: 51.94151 xmax: 7.546705 ymax: 51.96119
#> # Geodetic CRS: WGS 84
#> #
#> # Node data: 987 × 2 (active)
#>              geometry    sc
#>           <POINT [°]> <dbl>
#> 1 (7.538109 51.95286) 0.738
#> 2 (7.537867 51.95282) 0.737
#> 3 (7.537815 51.95867) 0.776
#> 4 (7.537015 51.95848) 0.767
#> 5 (7.533441 51.95578) 0.768
#> 6 (7.533415 51.95561) 0.768
#> # ℹ 981 more rows
#> #
#> # Edge data: 1,215 × 5
#>    from    to name               type                                   geometry
#>   <int> <int> <chr>              <chr>                          <LINESTRING [°]>
#> 1     1     2 Hagemanns Kämpken  residential (7.538109 51.95286, 7.537867 51.95…
#> 2     3     4 Stiegkamp          residential (7.537815 51.95867, 7.537015 51.95…
#> 3     5     6 Havixbecker Straße residential (7.533441 51.95578, 7.533467 51.95…
#> # ℹ 1,212 more rows