Extract an interconnected set of consumers and providers from a set of connections within catchment areas.

catchment_network(connections, from_start = NULL, to_start = NULL)

Arguments

connections

A list- or matrix-like object with "from" and "to" entries, such as that returned from catchment_connections.

from_start, to_start

The ID of a from (consumer) or to (provider) in connections from which to trace out a network.

Value

A subsetted version of connections containing only connections traceable from from_start

and/or to_start.

Examples

pop <- simulate_catchments()
connections <- catchment_connections(
  pop$consumers, pop$providers,
  weight = 1, max_cost = .5,
)
catchment_network(connections, 1)
#>    from to weight       cost
#> 1     1  2      1 0.21164374
#> 10   12  2      1 0.43739009
#> 12   15  2      1 0.34424315
#> 13   15  6      1 0.39019036
#> 14   16  2      1 0.28012103
#> 16   20  2      1 0.37595259
#> 17   20  6      1 0.40128483
#> 18   21  2      1 0.14441649
#> 19   23  2      1 0.18851221
#> 24   29  2      1 0.31000280
#> 27   36  6      1 0.22651962
#> 31   41  2      1 0.36093775
#> 32   41  6      1 0.36428642
#> 33   42  2      1 0.07281986
#> 36   46  2      1 0.18735159
#> 37   47  2      1 0.44635921
#> 38   48  6      1 0.14104054
#> 40   51  6      1 0.44577889
#> 44   56  6      1 0.42333806
#> 47   60  2      1 0.42849016
#> 48   60  6      1 0.47938185
#> 52   68  2      1 0.33156502
#> 54   70  2      1 0.44707235
#> 56   72  2      1 0.31639899
#> 58   74  6      1 0.32799096
#> 63   83  6      1 0.09583488
#> 72   95  6      1 0.40943445
#> 73   98  2      1 0.36883076