An S4 class which holds information on origin-destination (OD) pairs. Each OD pair is composed of two nodes, each belonging to one network. All origin nodes must belong to the same origin network should be contained in one spflow_network-class() - and likewise for the destinations.

# S4 method for spflow_network_pair
dat(object)

# S4 method for spflow_network_pair
dat(object) <- value

# S4 method for spflow_network_pair
id(object)

# S4 method for spflow_network_pair
id(object, which = "pair") <- value

# S4 method for spflow_network_pair
npairs(object)

# S4 method for spflow_network_pair
nnodes(object)

# S4 method for spflow_network_pair
update_dat(object, new_dat)

Arguments

object

A spflow_network_pair-class

value

An object to replace the existing id/data

which

A character indicating which of the ids to change, should be one of c("origin", "destination", "pair"). The first characters may be used as shortcuts.

new_dat

A data.frame

Slots

id_net_pair

A character identifying the set of origin-destination pairs

id_orig_net

A character that serves as identifier for the origin nodes

id_dest_net

A character that serves as identifier for the destination network

pair_data

A data.frame containing information on origin-destination pairs

Examples

## access the data describing the node pairs
net_pair_ge_ge <- pull_member(multi_net_usa_ge,"ge_ge")
dat(net_pair_ge_ge)
#>     ID_DEST ID_ORIG DISTANCE          y9           y2           y1
#> 1        SH      SH 0.000000  68.4148262  68.13848147  47.47474857
#> 2        HH      SH 1.000000  51.0915798  35.72717997  20.91622029
#> 3        MV      SH 1.414214  60.9845481  42.87078577  22.22844389
#> 4        NW      SH 2.236068  20.9280007  23.67566099   6.79889712
#> 5        HB      SH 2.000000  46.6902544  38.46271283  16.47730823
#> 6        BB      SH 2.236068  55.6089587  41.68555302  27.85172431
#> 7        BE      SH 2.828427  36.5147164  31.51151365  16.36939928
#> 8        RP      SH 3.162278  17.8758703  15.09938478   9.97154874
#> 9        NI      SH 3.000000  46.9381691  38.03391627  29.70844528
#> 10       ST      SH 3.162278  35.9326122  30.41361547  18.36991203
#> 11       SN      SH 3.605551  27.6936682  24.40377150  14.28037363
#> 12       SL      SH 4.123106   8.8203044   9.24663760   3.93331022
#> 13       HE      SH 4.000000  14.7202260  15.83360440   6.70432271
#> 14       TH      SH 4.123106  11.5233219  13.70237184   2.33428993
#> 15       BW      SH 5.000000  -3.1936452  -0.59814949  -5.39388220
#> 16       BY      SH 5.099020  -5.9956280   3.09363760  -4.44209965
#> 17       SH      HH 1.000000  39.6252187  40.17990992  10.88519719
#> 18       HH      HH 0.000000  80.4047912  78.06642687  58.68175558
#> 19       MV      HH 1.000000  50.1815959  45.92820058  21.03788534
#> 20       NW      HH 1.414214  34.7149880  25.61039487   8.87655803
#> 21       HB      HH 1.000000  51.4474299  41.01750818  20.77935074
#> 22       BB      HH 1.414214  57.4900766  46.03245004  29.03948280
#> 23       BE      HH 2.236068  33.7440184  30.14142247  14.60718384
#> 24       RP      HH 2.236068  21.2242833  18.58767594   4.18472437
#> 25       NI      HH 2.000000  48.1719140  35.35294705  25.66170039
#> 26       ST      HH 2.236068  34.8719960  31.58165448  18.90641931
#> 27       SN      HH 2.828427  28.4297909  22.43074375   9.63260796
#> 28       SL      HH 3.162278   9.0874224  11.98108491   3.94315712
#> 29       HE      HH 3.000000  16.1230813  12.45778894   8.36593458
#> 30       TH      HH 3.162278   9.7477330  11.15972447   5.96012239
#> 31       BW      HH 4.000000  -3.4694232  -3.28239270  -6.56339182
#> 32       BY      HH 4.123106  -7.1090509  -2.97057513  -5.56307860
#> 33       SH      MV 1.414214  31.8272167  27.86551483   4.32197440
#> 34       HH      MV 1.000000  34.8867035  28.21090970   8.78573426
#> 35       MV      MV 0.000000  88.2518758  85.18408380  65.70205938
#> 36       NW      MV 2.236068  10.3896401  11.30145917   1.13285418
#> 37       HB      MV 1.414214  37.1069503  26.50633823  17.04620405
#> 38       BB      MV 1.000000  50.6940892  37.07639987  24.04974489
#> 39       BE      MV 1.414214  37.0534713  33.82080423   9.17737368
#> 40       RP      MV 2.828427   6.8622353  10.42404156  -1.70463708
#> 41       NI      MV 2.236068  41.0833607  25.46464878  18.98448768
#> 42       ST      MV 2.000000  29.0462884  23.16081582  12.96551414
#> 43       SN      MV 2.236068  21.1427333  19.47966804   8.33219170
#> 44       SL      MV 3.605551  -0.3530937   1.70959037  -1.12768697
#> 45       HE      MV 3.162278   4.9236348   4.45920974   1.14024458
#> 46       TH      MV 3.000000   1.4324217   1.76972296  -6.12869367
#> 47       BW      MV 4.123106 -16.8460120 -10.23295117  -7.96166991
#> 48       BY      MV 4.000000 -17.3820966  -7.98098634  -8.16943046
#> 49       SH      NW 2.236068  29.6314287  30.40112977  11.29005467
#> 50       HH      NW 1.414214  46.5974648  38.85376922  17.35003663
#> 51       MV      NW 2.236068  43.2034317  39.64436621  21.79181367
#> 52       NW      NW 0.000000  63.6169156  63.72886679  41.36621313
#> 53       HB      NW 1.000000  57.8378864  46.39125595  28.23211581
#> 54       BB      NW 2.000000  57.1876396  49.32845181  32.25161876
#> 55       BE      NW 3.000000  38.5548284  37.92893307  15.20223320
#> 56       RP      NW 1.000000  41.8135762  36.21743671  16.32144569
#> 57       NI      NW 1.414214  72.5148023  50.53828300  36.10071138
#> 58       ST      NW 2.236068  46.9755972  40.56933523  21.53196890
#> 59       SN      NW 3.162278  39.5871234  31.21780848  14.46764019
#> 60       SL      NW 2.000000  26.8665277  28.92970235   8.65706394
#> 61       HE      NW 2.236068  33.8553055  28.07974641  15.82378342
#> 62       TH      NW 2.828427  30.1174226  25.85507004   8.53233510
#> 63       BW      NW 3.162278  10.7016871  12.04691713   0.86329174
#> 64       BY      NW 3.605551   7.2947582  10.08637171  -0.07660876
#> 65       SH      HB 2.000000  18.8627642  16.59130801   4.13186389
#> 66       HH      HB 1.000000  39.3559468  27.39810966   6.25791914
#> 67       MV      HB 1.414214  39.8994316  30.65605277  13.84919466
#> 68       NW      HB 1.000000  29.9107098  19.46918068   1.96542182
#> 69       HB      HB 0.000000  95.3968049  82.48486627  67.70433337
#> 70       BB      HB 1.000000  54.3081136  37.09720580  23.26355497
#> 71       BE      HB 2.000000  29.4944789  24.92561433  10.44636568
#> 72       RP      HB 1.414214  22.2611698  16.97084272   4.12617574
#> 73       NI      HB 1.000000  52.7395715  38.82722277  25.59289166
#> 74       ST      HB 1.414214  41.2684850  28.63279450  14.43886380
#> 75       SN      HB 2.236068  28.3596786  19.32537161   3.48805792
#> 76       SL      HB 2.236068   9.0219840  10.08661921   3.64349577
#> 77       HE      HB 2.000000  12.6026134  10.64319072   5.33861400
#> 78       TH      HB 2.236068   8.4180407   8.95130312   0.70447567
#> 79       BW      HB 3.000000  -7.5985895  -4.62294020  -6.64210700
#> 80       BY      HB 3.162278  -9.9314637  -7.36866865  -5.81211139
#> 81       SH      BB 2.236068   8.4730321   8.66237720  -1.07031571
#> 82       HH      BB 1.414214  25.1835958  22.32918145   6.73760440
#> 83       MV      BB 1.000000  34.1688753  27.11537885  11.57798347
#> 84       NW      BB 2.000000   6.3372813   3.78292954  -4.47285700
#> 85       HB      BB 1.000000  37.1312043  25.24475193  11.57052975
#> 86       BB      BB 0.000000 105.4636464  93.04487472  82.50297481
#> 87       BE      BB 1.000000  35.7539803  29.14022479   6.58717669
#> 88       RP      BB 2.236068   3.5443899   4.12740636  -4.48970984
#> 89       NI      BB 1.414214  42.1524450  27.25670627  19.44503103
#> 90       ST      BB 1.000000  33.9500019  27.38704377  13.65351804
#> 91       SN      BB 1.414214  29.4132517  20.84258067   2.16090714
#> 92       SL      BB 2.828427  -1.6416378  -8.06797884  -3.33016983
#> 93       HE      BB 2.236068   8.5756506   0.91666058   0.65850348
#> 94       TH      BB 2.000000   4.9464110   0.01031869  -2.67679629
#> 95       BW      BB 3.162278 -16.6937681 -18.78419496  -9.68720989
#> 96       BY      BB 3.000000 -14.9851085 -12.86792455  -8.35549597
#> 97       SH      BE 2.828427  16.1006108  14.45355343   1.71991974
#> 98       HH      BE 2.236068  28.7435015  21.83215605  12.15510482
#> 99       MV      BE 1.414214  47.6973609  31.52955541  16.69322092
#> 100      NW      BE 3.000000  16.1941489  14.36923103   1.51472264
#> 101      HB      BE 2.000000  38.4536699  33.47457601  17.84756642
#> 102      BB      BE 1.000000  58.4857912  41.20050589  25.83778383
#> 103      BE      BE 0.000000  82.8481329  75.11034275  56.07427108
#> 104      RP      BE 3.162278  10.3951685  15.55861905   1.34036346
#> 105      NI      BE 2.236068  43.4202626  36.01627222  27.14612254
#> 106      ST      BE 1.414214  46.7714317  38.70444664  19.24580369
#> 107      SN      BE 1.000000  40.2327996  33.76958602  12.82835215
#> 108      SL      BE 3.605551   6.4434700   6.94827878  -0.82851123
#> 109      HE      BE 2.828427  15.5591935  12.61415202   8.68699366
#> 110      TH      BE 2.236068  13.6253932  16.36296371   5.38396305
#> 111      BW      BE 3.605551  -6.4319400  -4.01613039  -7.31102691
#> 112      BY      BE 3.162278  -5.8267377   0.27194325  -4.07430256
#> 113      SH      RP 3.162278  22.3163367  24.06733942   9.64650804
#> 114      HH      RP 2.236068  39.1895413  35.96285760  19.01689968
#> 115      MV      RP 2.828427  41.9556715  33.84518446  17.39121966
#> 116      NW      RP 1.000000  40.9289816  31.32819511  11.93010809
#> 117      HB      RP 1.414214  53.3140852  43.48812973  26.07529363
#> 118      BB      RP 2.236068  55.9899779  43.79757278  26.38498285
#> 119      BE      RP 3.162278  38.3613642  29.42335931  17.87369851
#> 120      RP      RP 0.000000  69.5034605  63.85986832  49.36649235
#> 121      NI      RP 1.000000  69.9524473  49.19377945  29.89691806
#> 122      ST      RP 2.000000  47.2417418  36.63153823  23.43077270
#> 123      SN      RP 3.000000  39.3925773  29.26741501  11.10167415
#> 124      SL      RP 1.000000  39.2132063  30.27660328  10.81061509
#> 125      HE      RP 1.414214  43.2105984  26.99424955  16.39534411
#> 126      TH      RP 2.236068  27.5279254  17.48746875  10.24519251
#> 127      BW      RP 2.236068  14.1173888  12.84035071   3.96637971
#> 128      BY      RP 2.828427   8.6827454  13.86140272   4.88328107
#> 129      SH      NI 3.000000  -1.8873886   0.70989298  -5.76002423
#> 130      HH      NI 2.000000  13.4514100   9.92914059  -0.35617364
#> 131      MV      NI 2.236068  20.5622720  13.99812262   5.88097265
#> 132      NW      NI 1.414214  16.1267663  11.47158966  -4.87143371
#> 133      HB      NI 1.000000  31.3250800  19.12781570   9.89949114
#> 134      BB      NI 1.414214  40.9869847  27.01517275  12.18276406
#> 135      BE      NI 2.236068  13.2088565  14.23259646   2.21130711
#> 136      RP      NI 1.000000  16.7499169   5.52735480  -0.80412722
#> 137      NI      NI 0.000000 111.8449323  95.92859820  89.52151303
#> 138      ST      NI 1.000000  29.6706645  24.44910292  10.37531839
#> 139      SN      NI 2.000000  17.0139158  10.94955023   0.35246330
#> 140      SL      NI 1.414214  13.1136929  10.48760135  -4.08065641
#> 141      HE      NI 1.000000  17.3604798  11.08974920   1.79826521
#> 142      TH      NI 1.414214  13.8624768   7.56588513  -1.71095885
#> 143      BW      NI 2.000000  -7.4708816  -8.53278465 -10.96067397
#> 144      BY      NI 2.236068 -10.6788912 -11.47275475 -10.77682128
#> 145      SH      ST 3.162278  10.9508987   5.96927986   1.52464398
#> 146      HH      ST 2.236068  22.7539488  16.24346795   6.13270248
#> 147      MV      ST 2.000000  35.2198949  23.03792961  12.56419003
#> 148      NW      ST 2.236068  13.7605806   8.34461492   1.13573372
#> 149      HB      ST 1.414214  41.9497631  29.61066657  12.69817727
#> 150      BB      ST 1.000000  53.9856189  38.23681548  23.23050908
#> 151      BE      ST 1.414214  38.7791143  33.37629530  10.25886071
#> 152      RP      ST 2.000000  14.5488615   8.68339022   0.13533652
#> 153      NI      ST 1.000000  55.7494614  34.61908943  20.81042103
#> 154      ST      ST 0.000000  90.7361450  81.78796430  68.28432931
#> 155      SN      ST 1.000000  38.1688195  26.90121353   8.73102404
#> 156      SL      ST 2.236068  13.1301918   6.97148852  -1.19367166
#> 157      HE      ST 1.414214  23.0988968  15.06488108  10.64051342
#> 158      TH      ST 1.000000  19.5475629  12.33550378   2.54713524
#> 159      BW      ST 2.236068  -3.0488547  -1.67691083  -2.84175553
#> 160      BY      ST 2.000000  -1.9266496  -1.23819465  -2.93808015
#> 161      SH      SN 3.605551  12.3140295  16.33004668   0.91376794
#> 162      HH      SN 2.828427  24.5304716  19.91599926   8.13225723
#> 163      MV      SN 2.236068  37.0732012  30.66480126  15.67139704
#> 164      NW      SN 3.162278  13.4919748  13.08223106   2.14398576
#> 165      HB      SN 2.236068  39.4735594  27.30793438  16.48086050
#> 166      BB      SN 1.414214  61.1673134  43.38630305  26.98248294
#> 167      BE      SN 1.000000  52.4064691  38.14840552  16.41462620
#> 168      RP      SN 3.000000  14.5146190  13.45752984  -0.49069242
#> 169      NI      SN 2.000000  48.4607167  37.39680721  25.58256645
#> 170      ST      SN 1.000000  54.6883157  38.16079768  17.43894345
#> 171      SN      SN 0.000000  85.3539281  77.65990036  60.37562227
#> 172      SL      SN 3.162278  12.0951492  10.53965947   1.31779406
#> 173      HE      SN 2.236068  21.3717446  14.84454414   7.11845605
#> 174      TH      SN 1.414214  23.3532644  22.43411181   6.97434648
#> 175      BW      SN 2.828427   4.3310194   0.92676829  -1.01482001
#> 176      BY      SN 2.236068   2.5150709   1.58482144  -4.14532033
#> 177      SH      SL 4.123106  18.9910776  16.93643561   6.43831671
#> 178      HH      SL 3.162278  37.8830959  26.21257500  11.20868349
#> 179      MV      SL 3.605551  39.7768324  29.90131506  17.16631928
#> 180      NW      SL 2.000000  30.8825897  30.39354388  11.40808382
#> 181      HB      SL 2.236068  42.5385961  41.46011911  23.11677309
#> 182      BB      SL 2.828427  53.6271707  42.96150230  28.89207052
#> 183      BE      SL 3.605551  38.1887236  27.24026503  14.24151698
#> 184      RP      SL 1.000000  41.2328466  34.00374812  13.23763410
#> 185      NI      SL 1.414214  71.2827132  50.59044439  36.63977374
#> 186      ST      SL 2.236068  52.1421489  38.11435798  21.62816093
#> 187      SN      SL 3.162278  38.3906960  29.50805759  15.42832657
#> 188      SL      SL 0.000000  67.3680612  60.81472253  48.96198293
#> 189      HE      SL 1.000000  45.4242200  31.37955910  18.76694705
#> 190      TH      SL 2.000000  30.3496619  28.14076009  14.05084138
#> 191      BW      SL 1.414214  24.1517893  22.73122935   6.43937697
#> 192      BY      SL 2.236068  11.6888139  16.01273306   2.02899051
#> 193      SH      HE 4.000000  15.3874884  16.66871531   2.40736427
#> 194      HH      HE 3.000000  29.4299400  27.75085023   9.37414483
#> 195      MV      HE 3.162278  40.2226732  29.53626731  15.99773046
#> 196      NW      HE 2.236068  25.6019835  24.37133228   4.30376783
#> 197      HB      HE 2.000000  45.0500177  36.97678127  20.87590736
#> 198      BB      HE 2.236068  50.0242537  38.63931332  22.16403127
#> 199      BE      HE 2.828427  35.9633705  29.62206154  16.65418907
#> 200      RP      HE 1.414214  31.1369960  27.85894211  13.12520547
#> 201      NI      HE 1.000000  66.3801883  44.10814191  29.50598155
#> 202      ST      HE 1.414214  53.8113694  36.82814941  21.80892246
#> 203      SN      HE 2.236068  36.7566006  27.91794125  12.67306684
#> 204      SL      HE 1.000000  38.1787426  33.24795314   8.51570319
#> 205      HE      HE 0.000000  80.7985484  71.68926939  52.36302234
#> 206      TH      HE 1.000000  37.7228702  26.42171759  10.97838244
#> 207      BW      HE 1.000000  29.5630026  22.79037422   4.85982491
#> 208      BY      HE 1.414214  27.6304885  23.31708531   7.07064882
#> 209      SH      TH 4.123106  19.8386999  15.27322302   1.87309216
#> 210      HH      TH 3.162278  29.5058199  24.03843756  11.76215884
#> 211      MV      TH 3.000000  42.0413726  29.29316256  20.69340932
#> 212      NW      TH 2.828427  25.1332045  20.37033210   8.18282680
#> 213      HB      TH 2.236068  49.7193521  35.58256269  22.15435140
#> 214      BB      TH 2.000000  54.5830481  44.60624902  27.06323984
#> 215      BE      TH 2.236068  42.2700568  38.75557442  18.42701994
#> 216      RP      TH 2.236068  31.0875598  27.68133090  10.39331870
#> 217      NI      TH 1.414214  66.9399797  49.68790282  32.49301488
#> 218      ST      TH 1.000000  57.7447327  44.60297706  24.72033209
#> 219      SN      TH 1.414214  48.7738184  40.69989501  21.36782242
#> 220      SL      TH 2.000000  32.4706573  27.57674473  13.15320589
#> 221      HE      TH 1.000000  45.8465173  33.88155361  20.46399261
#> 222      TH      TH 0.000000  71.0654413  65.72067719  46.39899499
#> 223      BW      TH 1.414214  31.9614460  26.06642963   6.18201924
#> 224      BY      TH 1.000000  32.5003030  24.65062314   7.43277408
#> 225      SH      BW 5.000000  26.1619952  21.32096390  10.44828953
#> 226      HH      BW 4.000000  36.1207597  33.84631977  14.44055902
#> 227      MV      BW 4.123106  50.4520503  33.33050920  20.22595341
#> 228      NW      BW 3.162278  33.1206830  30.25163732  11.72554308
#> 229      HB      BW 3.000000  50.2640769  43.08247885  25.44213940
#> 230      BB      BW 3.162278  59.8482959  54.15710295  28.74924905
#> 231      BE      BW 3.605551  44.7839799  32.86275496  23.07527750
#> 232      RP      BW 2.236068  37.2513979  32.45308575  13.47680676
#> 233      NI      BW 2.000000  66.1677123  54.60967572  32.12188565
#> 234      ST      BW 2.236068  57.0860880  49.59248998  26.71925854
#> 235      SN      BW 2.828427  46.6029291  40.15340425  22.74960557
#> 236      SL      BW 1.414214  42.9423123  35.39231261  17.36285997
#> 237      HE      BW 1.000000  46.6187224  45.58479869  22.47659494
#> 238      TH      BW 1.414214  45.4592405  34.58153174  19.08376454
#> 239      BW      BW 0.000000  59.2419521  53.94524135  39.30205359
#> 240      BY      BW 1.000000  37.6144094  32.63045499  12.80739309
#> 241      SH      BY 5.099020  24.2232823  27.85803156   9.75324454
#> 242      HH      BY 4.123106  36.6611396  32.52255796  14.79150850
#> 243      MV      BY 4.000000  44.1953308  38.90225515  18.82894030
#> 244      NW      BY 3.605551  32.4136515  31.35367622  10.35652795
#> 245      HB      BY 3.162278  52.8088138  43.61614012  21.34917377
#> 246      BB      BY 3.000000  60.9728329  46.11332282  26.78817705
#> 247      BE      BY 3.162278  49.1836466  39.98027770  19.40107578
#> 248      RP      BY 2.828427  37.1598466  31.58786403  11.28619358
#> 249      NI      BY 2.236068  68.1563045  55.21425143  35.36197554
#> 250      ST      BY 2.000000  59.6373815  46.08509200  26.98229550
#> 251      SN      BY 2.236068  49.9928299  37.02666260  19.39246017
#> 252      SL      BY 2.236068  40.5632144  33.24059002  17.97092456
#> 253      HE      BY 1.414214  53.4507614  40.11147614  20.72795442
#> 254      TH      BY 1.000000  50.4813709  38.09461630  21.37674304
#> 255      BW      BY 1.000000  36.6000497  28.92455840  12.20649124
#> 256      BY      BY 0.000000  59.8385064  53.92510163  38.87477145

## access the id of a network pair
net_pair_ge_ge <- pull_member(multi_net_usa_ge,"ge_ge")
id(net_pair_ge_ge)
#>    pair    orig    dest 
#> "ge_ge"    "ge"    "ge" 

## access the number of node pairs in a network pair
net_pair_ge_ge <- pull_member(multi_net_usa_ge,"ge_ge")
npairs(net_pair_ge_ge)
#> [1] 256

## access the number of origin and destination nodes in a network pair
net_pair_ge_ge <- pull_member(multi_net_usa_ge,"ge_ge")
nnodes(net_pair_ge_ge)
#> orig dest 
#>   16   16 
nnodes(net_pair_ge_ge)["orig"]
#> orig 
#>   16 
nnodes(net_pair_ge_ge)["dest"]
#> dest 
#>   16 
prod(nnodes(net_pair_ge_ge) == npairs(net_pair_ge_ge))
#> [1] 0