2. Pedestrian Routing

../_images/route.png

pgRouting was first called pgDijkstra, because it implemented only shortest path search with Dijkstra algorithm. Later other functions were added and the library was renamed to pgRouting.

2.1. pgr_dijkstra

Dijkstra algorithm was the first algorithm implemented in pgRouting. It doesn’t require other attributes than the identifiers id, source and target and the weights cost and reverse_cost.

You can specify when to consider the graph as directed or undirected.

Signature Summary

pgr_dijkstra(Edges SQL, start_vid,  end_vid  [, directed])
pgr_dijkstra(Edges SQL, start_vid,  end_vids [, directed])
pgr_dijkstra(Edges SQL, start_vids, end_vid  [, directed])
pgr_dijkstra(Edges SQL, start_vids, end_vids [, directed])
pgr_dijkstra(Edges SQL, Combinations SQL [, directed])

RETURNS SET OF (seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost)
    OR EMPTY SET

Description of the function can be found in pgr_dijkstra.

Note

  • Many pgRouting functions have sql::text as one of their arguments. While this may look confusing at first, it makes the functions very flexible as the user can pass a SELECT statement as function argument as long as the returned result contains the required number of attributes and the correct attribute names.

  • Most of pgRouting implemented algorithms do not require the geometry.

  • The pgRouting functions do not return a geometry, but only an ordered list of nodes or edges.

Identifiers for the Queries

The assignment of the vertices identifiers on the source and target columns may be different, the following exercises will use the results of this query. For the workshop, some locations near of the FOSS4G event are going to be used. These locations are within this area https://www.openstreetmap.org/#map=14/-1.44228/-48.46069

  • 10982869752 Hangar Convention Center

  • 11818739588 Instituto Federal do Pará, Campus Belém

  • 491465035 Palacete Bolonha

  • 1069202329 Forte do Castelo

  • 5661895682 Estação das Docas

Connect to the database, if not connected:

psql city_routing

Get the vertex identifiers

SELECT osm_id, id FROM ways_vertices_pgr
WHERE osm_id IN (10982869752, 11818739588, 491465035, 1069202329, 5661895682)
ORDER BY osm_id;

   osm_id    |  id   
-------------+-------
   491465035 |   717
  1069202329 |  6548
  5661895682 | 12712
 10982869752 | 20297
 11818739588 | 23872
(5 rows)

  • 10982869752 Hangar Convention Center (20297)

  • 11818739588 Instituto Federal do Pará, Campus Belém (23872)

  • 491465035 Palacete Bolonha (717)

  • 1069202329 Forte do Castelo (6548)

  • 5661895682 Estação das Docas (12712)

The corresponding id are shown in the following image, and a sample route from “Palacete Bolonha” to “Estação das Docas”.

../_images/route.png

2.1.1. Exercise 1: Single pedestrian routing

Problem:

  • Walking

    • from “Hangar Convention Center”

    • to “Palacete Bolonha”.

  • Calculate routes with costs in osm2pgRouting length default units.

From the |place_1| to the |place_3|

Solution:

  • The pedestrian wants to go from vertex 20297 to vertex 717 (lines 9 and 10).

  • The pedestrian’s cost is in terms of length. In this case length (line 6), which was calculated by osm2pgrouting, is in unit degrees.

  • From a pedestrian perspective the graph is undirected (line 11), that is, the pedestrian can move in both directions on all segments.

SELECT * FROM pgr_dijkstra(
  '
    SELECT gid AS id,
      source,
      target,
      length AS cost      -- line 6
    FROM ways
  ',
  20297, -- line 9
  717, -- line 10
  directed := false); -- line 11
 seq | path_seq | start_vid | end_vid | node  | edge  |          cost          |       agg_cost        
-----+----------+-----------+---------+-------+-------+------------------------+-----------------------
   1 |        1 |     20297 |     717 | 20297 | 31885 |  0.0001716356422320464 |                     0
   2 |        2 |     20297 |     717 | 20296 |    91 |  0.0001153433569785665 | 0.0001716356422320464
   3 |        3 |     20297 |     717 |    54 | 10915 | 0.00035708800864949733 | 0.0002869789992106129
   4 |        4 |     20297 |     717 |  7354 |  1743 |  0.0014322361816398747 | 0.0006440670078601103
   5 |        5 |     20297 |     717 |  1033 |  1775 |  0.0015143940604290334 |  0.002076303189499985
   6 |        6 |     20297 |     717 |  1051 | 10920 |  0.0009291231403867673 | 0.0035906972499290184
   7 |        7 |     20297 |     717 |  7357 |  1835 |  0.0006153841892071156 |  0.004519820390315786
   8 |        8 |     20297 |     717 |  1084 | 10927 |  0.0009010473905377392 |  0.005135204579522901
   9 |        9 |     20297 |     717 |  7361 |  1725 |  0.0005560954684229016 |  0.006036251970060641
  10 |       10 |     20297 |     717 |  1022 | 10346 |  0.0012567037916704972 |  0.006592347438483542
  11 |       11 |     20297 |     717 |  6953 | 27847 | 0.00015145418449423264 |   0.00784905123015404
  12 |       12 |     20297 |     717 | 21151 |   540 | 0.00010643312454210425 |  0.008000505414648272
  13 |       13 |     20297 |     717 |   320 | 27845 | 0.00010051691400060946 |  0.008106938539190376
  14 |       14 |     20297 |     717 | 21149 | 10350 | 0.00017279285285780552 |  0.008207455453190985
  15 |       15 |     20297 |     717 |  6955 |   565 |  0.0012135304240127123 |   0.00838024830604879
  16 |       16 |     20297 |     717 |   333 | 15283 |  0.0004978948483381016 |  0.009593778730061503
  17 |       17 |     20297 |     717 | 10784 | 10752 |  0.0008473144934902617 |  0.010091673578399605
  18 |       18 |     20297 |     717 |  7234 | 10409 |  9.610020811439204e-05 |  0.010938988071889866
  19 |       19 |     20297 |     717 |  6990 | 10411 |  7.496939375540897e-05 |  0.011035088280004258
  20 |       20 |     20297 |     717 |  6991 | 15288 |  0.0012184804060786285 |  0.011110057673759667
  21 |       21 |     20297 |     717 | 10787 |   375 | 0.00024798082587396635 |  0.012328538079838296
  22 |       22 |     20297 |     717 |   226 | 15295 | 0.00021386897858363462 |  0.012576518905712262
  23 |       23 |     20297 |     717 | 10791 | 13798 | 0.00041691485941307445 |  0.012790387884295897
  24 |       24 |     20297 |     717 |  9580 | 27297 | 0.00048219433841428674 |  0.013207302743708972
  25 |       25 |     20297 |     717 | 20647 |  3285 |   0.000378614645781829 |  0.013689497082123258
  26 |       26 |     20297 |     717 |  2040 | 15304 |  0.0001014000493093058 |  0.014068111727905086
  27 |       27 |     20297 |     717 | 10796 | 13799 |   0.000690339141293269 |  0.014169511777214393
  28 |       28 |     20297 |     717 |  9581 | 10935 |   6.14524206174259e-05 |  0.014859850918507661
  29 |       29 |     20297 |     717 |  7366 |  3256 |  0.0006448366416395072 |  0.014921303339125088
  30 |       30 |     20297 |     717 |  2023 | 15305 | 0.00019525624189873058 |  0.015566139980764594
  31 |       31 |     20297 |     717 | 10797 | 18878 | 0.00041348876647511075 |  0.015761396222663326
  32 |       32 |     20297 |     717 | 13516 | 18875 | 0.00037592032400472335 |  0.016174884989138435
  33 |       33 |     20297 |     717 | 13514 | 18321 | 0.00039010831828777424 |   0.01655080531314316
  34 |       34 |     20297 |     717 | 13078 |  3255 |  8.531377380122786e-05 |  0.016940913631430934
  35 |       35 |     20297 |     717 |  2022 | 18324 | 0.00011548991298170257 |  0.017026227405232162
  36 |       36 |     20297 |     717 | 13081 | 18872 |  0.0008118415241947302 |  0.017141717318213866
  37 |       37 |     20297 |     717 | 13512 | 12139 | 0.00031002412809421687 |  0.017953558842408596
  38 |       38 |     20297 |     717 |  8261 | 15310 | 0.00015540093307229479 |  0.018263582970502814
  39 |       39 |     20297 |     717 | 10800 |  1655 |  9.117335137152959e-05 |   0.01841898390357511
  40 |       40 |     20297 |     717 |   983 | 12144 | 0.00012580381552128363 |   0.01851015725494664
  41 |       41 |     20297 |     717 |  8264 | 15317 | 0.00016713542413305483 |  0.018635961070467923
  42 |       42 |     20297 |     717 | 10804 |  1657 |  0.0012063682718777141 |  0.018803096494600977
  43 |       43 |     20297 |     717 |   985 | 10077 |  0.0007259629664562226 |   0.02000946476647869
  44 |       44 |     20297 |     717 |  6769 | 10359 |  0.0001000641794043222 |  0.020735427732934915
  45 |       45 |     20297 |     717 |  6960 |  7947 | 0.00024665183964426847 |  0.020835491912339237
  46 |       46 |     20297 |     717 |  5227 |   508 | 0.00039454221573752794 |  0.021082143751983504
  47 |       47 |     20297 |     717 |   302 | 23247 |   0.000920938461572996 |   0.02147668596772103
  48 |       48 |     20297 |     717 | 16963 |  1628 | 0.00014692055676409702 |  0.022397624429294025
  49 |       49 |     20297 |     717 |   966 |  1636 |  0.0003061667846102729 |  0.022544544986058124
  50 |       50 |     20297 |     717 |   971 |   148 |  0.0008497233782684474 |  0.022850711770668396
  51 |       51 |     20297 |     717 |    83 | 23450 |  0.0008890276261183315 |  0.023700435148936844
  52 |       52 |     20297 |     717 | 17152 |   320 | 2.9017236240749123e-06 |  0.024589462775055176
  53 |       53 |     20297 |     717 |   197 | 24810 |  0.0004980350690443442 |   0.02459236449867925
  54 |       54 |     20297 |     717 | 18350 | 24809 |  0.0006030831203066024 |  0.025090399567723593
  55 |       55 |     20297 |     717 | 18349 | 24808 | 0.00048704296525094236 |  0.025693482688030195
  56 |       56 |     20297 |     717 | 14742 | 20526 |  0.0009790988058816124 |  0.026180525653281137
  57 |       57 |     20297 |     717 | 14743 | 20527 |  0.0015278460459091654 |   0.02715962445916275
  58 |       58 |     20297 |     717 | 14816 | 20632 |  5.742821608782239e-06 |  0.028687470505071914
  59 |       59 |     20297 |     717 | 13558 | 18926 | 0.00016280334762850662 |  0.028693213326680695
  60 |       60 |     20297 |     717 |   666 |  1096 | 2.7879203724024733e-05 |    0.0288560166743092
  61 |       61 |     20297 |     717 | 14817 | 20508 |  0.0005125725802262838 |  0.028883895878033226
  62 |       62 |     20297 |     717 | 14729 | 20510 |   6.76874937153904e-05 |   0.02939646845825951
  63 |       63 |     20297 |     717 | 14731 | 20507 | 0.00040236167574913325 |    0.0294641559519749
  64 |       64 |     20297 |     717 | 14728 |   797 |  0.0008595892650021071 |  0.029866517627724035
  65 |       65 |     20297 |     717 |   478 |   796 |  0.0005068526018492698 |  0.030726106892726143
  66 |       66 |     20297 |     717 | 13547 | 18913 |  0.0005561129831220051 |  0.031232959494575413
  67 |       67 |     20297 |     717 | 20914 | 27615 |  0.0010183971528011683 |   0.03178907247769742
  68 |       68 |     20297 |     717 | 20111 | 26760 |  0.0011906268768953432 |   0.03280746963049859
  69 |       69 |     20297 |     717 |    72 |   126 |  0.0005829686395677997 |   0.03399809650739393
  70 |       70 |     20297 |     717 |  9364 | 13530 |  0.0008118653213397823 |   0.03458106514696173
  71 |       71 |     20297 |     717 |  9366 | 13532 |  0.0011468094872314873 |   0.03539293046830151
  72 |       72 |     20297 |     717 |   251 |   419 |   8.81459017740482e-05 |     0.036539739955533
  73 |       73 |     20297 |     717 | 21086 | 27783 |  0.0009324789632337473 |   0.03662788585730705
  74 |       74 |     20297 |     717 | 20046 | 26695 |   0.000569570759434915 |    0.0375603648205408
  75 |       75 |     20297 |     717 | 18983 | 25545 |  0.0007433220365347046 |   0.03812993557997572
  76 |       76 |     20297 |     717 | 20911 | 27608 |  8.955947743912207e-05 |   0.03887325761651042
  77 |       77 |     20297 |     717 | 10808 | 15323 | 3.0645391174146184e-05 |   0.03896281709394954
  78 |       78 |     20297 |     717 | 21085 | 27782 |  0.0007849395645506308 |  0.038993462485123684
  79 |       79 |     20297 |     717 |   728 |  1206 | 0.00011629625961089318 |   0.03977840204967432
  80 |       80 |     20297 |     717 | 10810 | 15325 |  0.0016048626670253257 |   0.03989469830928521
  81 |       81 |     20297 |     717 |  8577 | 12537 | 0.00014432498051351742 |   0.04149956097631053
  82 |       82 |     20297 |     717 |   661 |  1087 |  8.932244958282459e-05 |   0.04164388595682405
  83 |       83 |     20297 |     717 | 10814 | 15331 |  0.0003494017744649616 |  0.041733208406406874
  84 |       84 |     20297 |     717 | 17298 | 23598 | 0.00016465542809618596 |   0.04208261018087184
  85 |       85 |     20297 |     717 | 15358 | 21349 |  7.746612162524057e-05 |   0.04224726560896802
  86 |       86 |     20297 |     717 | 19603 | 26253 | 0.00033966537945237166 |  0.042324731730593264
  87 |       87 |     20297 |     717 |   726 |  1202 | 0.00012130000000271233 |   0.04266439711004563
  88 |       88 |     20297 |     717 | 10625 | 15091 | 0.00012007530970053932 |   0.04278569711004834
  89 |       89 |     20297 |     717 |   114 |   192 | 0.00011212314658415777 |   0.04290577241974888
  90 |       90 |     20297 |     717 |  7483 | 11111 | 0.00010448392220662784 |   0.04301789556633304
  91 |       91 |     20297 |     717 | 11748 | 16610 |  0.0008334909844720124 |   0.04312237948853967
  92 |       92 |     20297 |     717 | 15362 | 21353 |  0.0011548489857998536 |   0.04395587047301168
  93 |       93 |     20297 |     717 |    88 |   156 |   0.001093741406410359 |   0.04511071945881153
  94 |       94 |     20297 |     717 |   702 |  1157 |  0.0011054645946431102 |   0.04620446086522189
  95 |       95 |     20297 |     717 |   703 | 11370 | 0.00039987193494949987 |     0.047309925459865
  96 |       96 |     20297 |     717 |  7674 | 11369 |  0.0009604047240030865 |  0.047709797394814506
  97 |       97 |     20297 |     717 |   717 |    -1 |                      0 |   0.04867020211881759
(97 rows)

Note

  • The returned cost attribute represents the cost specified in the inner SQL query (edges_sql::text argument). In this example cost is length in unit “degrees”. Cost may be time, distance or any combination of both or any other attributes or a custom formula.

  • node and edge results may vary depending on the assignment of the identifiers to the vertices given by osm2pgrouting.

2.1.2. Exercise 2: Many Pedestrians going to the same destination

Problem:

  • Walking

    • from “Hangar Convention Center” and “Instituto Federal do Pará, Campus Belém”

    • to the “Palacete Bolonha”.

  • Calculate routes with costs in osm2pgRouting length_m which is in meters.

From |place_1| and |place_2| to |place_3|

Solution:

  • The pedestrians are departing at vertices 20297 and 23872 (line 9).

  • All pedestrians want to go to vertex 717 (line 10).

  • The cost to be in meters using attribute length_m (line 6).

SELECT * FROM pgr_dijkstra(
  '
    SELECT gid AS id,
      source,
      target,
      length_m AS cost      -- line 6
    FROM ways
  ',
  ARRAY[20297,23872], -- line 9
  717, -- line 10
  directed := false);
 seq | path_seq | start_vid | end_vid | node  | edge  |        cost        |      agg_cost      
-----+----------+-----------+---------+-------+-------+--------------------+--------------------
   1 |        1 |     20297 |     717 | 20297 | 31885 |  19.04922354414803 |                  0
   2 |        2 |     20297 |     717 | 20296 |    91 |  12.78926072226459 |  19.04922354414803
   3 |        3 |     20297 |     717 |    54 | 10915 |   39.5671076415925 |  31.83848426641262
   4 |        4 |     20297 |     717 |  7354 |  1743 |  158.6837957434696 |  71.40559190800512
   5 |        5 |     20297 |     717 |  1033 |  1775 | 167.78395356928257 | 230.08938765147474
   6 |        6 |     20297 |     717 |  1051 | 10920 | 102.92511946988995 |  397.8733412207573
   7 |        7 |     20297 |     717 |  7357 |  1835 |  68.19110930865885 |  500.7984606906473
   8 |        8 |     20297 |     717 |  1084 | 10927 |  99.82172345575617 |  568.9895699993061
   9 |        9 |     20297 |     717 |  7361 |  1725 |  61.61000724303618 |  668.8112934550622
  10 |       10 |     20297 |     717 |  1022 | 10346 | 139.23345772586828 |  730.4213006980984
  11 |       11 |     20297 |     717 |  6953 | 27847 | 16.778562335233687 |  869.6547584239668
  12 |       12 |     20297 |     717 | 21151 |   540 | 11.791025096082985 |  886.4333207592005
  13 |       13 |     20297 |     717 |   320 | 27845 | 11.135994904149326 |  898.2243458552834
  14 |       14 |     20297 |     717 | 21149 | 10350 |   19.1436574278805 |  909.3603407594328
  15 |       15 |     20297 |     717 |  6955 |   565 |  134.4481603829688 |  928.5039981873133
  16 |       16 |     20297 |     717 |   333 | 15283 |  55.15905749288687 |  1062.952158570282
  17 |       17 |     20297 |     717 | 10784 | 10752 |   93.8844759408889 |  1118.111216063169
  18 |       18 |     20297 |     717 |  7234 | 10409 | 10.650754398735204 |  1211.995692004058
  19 |       19 |     20297 |     717 |  6990 | 10411 |  8.306480826585542 | 1222.6464464027931
  20 |       20 |     20297 |     717 |  6991 | 15288 | 134.98512697298662 | 1230.9529272293787
  21 |       21 |     20297 |     717 | 10787 |   375 |  27.48441685842097 | 1365.9380542023653
  22 |       22 |     20297 |     717 |   226 | 15295 | 23.694487199892734 | 1393.4224710607862
  23 |       23 |     20297 |     717 | 10791 | 13798 |  46.19619827064429 |  1417.116958260679
  24 |       24 |     20297 |     717 |  9580 | 27297 | 53.421228675072825 | 1463.3131565313233
  25 |       25 |     20297 |     717 | 20647 |  3285 |  41.94381432287399 | 1516.7343852063962
  26 |       26 |     20297 |     717 |  2040 | 15304 | 11.234231906216857 | 1558.6781995292702
  27 |       27 |     20297 |     717 | 10796 | 13799 |  76.47892458611274 |  1569.912431435487
  28 |       28 |     20297 |     717 |  9581 | 10935 |  6.804308669401253 | 1646.3913560215997
  29 |       29 |     20297 |     717 |  7366 |  3256 |  71.45078188203694 |  1653.195664691001
  30 |       30 |     20297 |     717 |  2023 | 15305 | 21.633738833760898 | 1724.6464465730378
  31 |       31 |     20297 |     717 | 10797 | 18878 |  45.80969310466399 | 1746.2801854067986
  32 |       32 |     20297 |     717 | 13516 | 18875 |  41.64964111635399 | 1792.0898785114625
  33 |       33 |     20297 |     717 | 13514 | 18321 |    43.219334329907 | 1833.7395196278164
  34 |       34 |     20297 |     717 | 13078 |  3255 |  9.451986453900842 | 1876.9588539577235
  35 |       35 |     20297 |     717 |  2022 | 18324 | 12.795207765637663 | 1886.4108404116243
  36 |       36 |     20297 |     717 | 13081 | 18872 |  89.94442092542114 | 1899.2060481772621
  37 |       37 |     20297 |     717 | 13512 | 12139 |  34.34799687163223 | 1989.1504691026832
  38 |       38 |     20297 |     717 |  8261 | 15310 | 17.216991656895356 | 2023.4984659743154
  39 |       39 |     20297 |     717 | 10800 |  1655 | 10.099242850065789 | 2040.7154576312107
  40 |       40 |     20297 |     717 |   983 | 12144 | 13.940714638871363 | 2050.8147004812763
  41 |       41 |     20297 |     717 |  8264 | 15317 | 18.518356614942633 | 2064.7554151201475
  42 |       42 |     20297 |     717 | 10804 |  1657 |  133.6559599847103 |   2083.27377173509
  43 |       43 |     20297 |     717 |   985 | 10077 |  80.43081020086365 | 2216.9297317198007
  44 |       44 |     20297 |     717 |  6769 | 10359 | 11.084409484689466 |  2297.360541920664
  45 |       45 |     20297 |     717 |  6960 |  7947 | 27.323231312556747 | 2308.4449514053535
  46 |       46 |     20297 |     717 |  5227 |   508 |  43.71855207462529 | 2335.7681827179103
  47 |       47 |     20297 |     717 |   302 | 23247 | 102.02780917539422 | 2379.4867347925356
  48 |       48 |     20297 |     717 | 16963 |  1628 | 16.276869188894402 |   2481.51454396793
  49 |       49 |     20297 |     717 |   966 |  1636 |  33.92142766986741 | 2497.7914131568245
  50 |       50 |     20297 |     717 |   971 |   148 |  94.35754431079903 |  2531.712840826692
  51 |       51 |     20297 |     717 |    83 | 23450 |  98.93406898092627 |  2626.070385137491
  52 |       52 |     20297 |     717 | 17152 |   320 | 0.3229142968666969 | 2725.0044541184175
  53 |       53 |     20297 |     717 |   197 | 24810 |  55.42322946628529 |  2725.327368415284
  54 |       54 |     20297 |     717 | 18350 | 24809 |  66.99879051180953 | 2780.7505978815693
  55 |       55 |     20297 |     717 | 18349 | 24808 |  53.90309602529898 |  2847.749388393379
  56 |       56 |     20297 |     717 | 14742 | 20526 | 108.27572862939664 |  2901.652484418678
  57 |       57 |     20297 |     717 | 14743 | 20527 |  170.0178358722283 | 3009.9282130480747
  58 |       58 |     20297 |     717 | 14816 | 20632 | 0.6390259249580291 |  3179.946048920303
  59 |       59 |     20297 |     717 | 13558 | 18926 | 18.117321199659763 |  3180.585074845261
  60 |       60 |     20297 |     717 |   666 |  1096 |  3.102407647363296 | 3198.7023960449205
  61 |       61 |     20297 |     717 | 14817 | 20508 | 56.677949106896804 | 3201.8048036922837
  62 |       62 |     20297 |     717 | 14729 | 20510 |  7.484667814901737 | 3258.4827527991806
  63 |       63 |     20297 |     717 | 14731 | 20507 |   44.5556166244529 |  3265.967420614082
  64 |       64 |     20297 |     717 | 14728 |   797 |  95.11088836546436 |  3310.523037238535
  65 |       65 |     20297 |     717 |   478 |   796 | 56.404370238782874 |  3405.633925603999
  66 |       66 |     20297 |     717 | 13547 | 18913 |  61.88661536818347 |  3462.038295842782
  67 |       67 |     20297 |     717 | 20914 | 27615 | 113.33145778790976 | 3523.9249112109655
  68 |       68 |     20297 |     717 | 20111 | 26760 |  132.4980175522514 |  3637.256368998875
  69 |       69 |     20297 |     717 |    72 |   126 |  64.83838426192042 | 3769.7543865511266
  70 |       70 |     20297 |     717 |  9364 | 13530 |  90.29593137006019 |  3834.592770813047
  71 |       71 |     20297 |     717 |  9366 | 13532 | 127.54886065426402 | 3924.8887021831074
  72 |       72 |     20297 |     717 |   251 |   419 |  9.804743704905192 | 4052.4375628373714
  73 |       73 |     20297 |     717 | 21086 | 27783 |  103.7218031654934 | 4062.2423065422768
  74 |       74 |     20297 |     717 | 20046 | 26695 |  63.35608288729345 |   4165.96410970777
  75 |       75 |     20297 |     717 | 18983 | 25545 |  82.67813690013293 |  4229.320192595063
  76 |       76 |     20297 |     717 | 20911 | 27608 |  9.959869019905426 |  4311.998329495196
  77 |       77 |     20297 |     717 | 10808 | 15323 |  3.408758557539933 |  4321.958198515102
  78 |       78 |     20297 |     717 | 21085 | 27782 |  87.31065760825057 | 4325.3669570726415
  79 |       79 |     20297 |     717 |   728 |  1206 | 12.937203397203643 | 4412.6776146808925
  80 |       80 |     20297 |     717 | 10810 | 15325 |  178.5123506779345 | 4425.6148180780965
  81 |       81 |     20297 |     717 |  8577 | 12537 |  16.05328674618939 |  4604.127168756031
  82 |       82 |     20297 |     717 |   661 |  1087 |  9.937347630998778 |  4620.180455502221
  83 |       83 |     20297 |     717 | 10814 | 15331 |  38.87032213542848 |  4630.117803133219
  84 |       84 |     20297 |     717 | 17298 | 23598 |  18.31500043883909 |  4668.988125268647
  85 |       85 |     20297 |     717 | 15358 | 21349 |   8.61759524541308 |  4687.303125707486
  86 |       86 |     20297 |     717 | 19603 | 26253 |  37.77922127947743 | 4695.9207209528995
  87 |       87 |     20297 |     717 |   726 |  1202 |  13.49527027628796 |  4733.699942232377
  88 |       88 |     20297 |     717 | 10625 | 15091 | 13.355183527927133 |  4747.195212508665
  89 |       89 |     20297 |     717 |   114 |   192 | 12.472079296809461 |  4760.550396036591
  90 |       90 |     20297 |     717 |  7483 | 11111 | 11.622287569354395 | 4773.0224753334005
  91 |       91 |     20297 |     717 | 11748 | 16610 |  92.59694883418848 |  4784.644762902755
  92 |       92 |     20297 |     717 | 15362 | 21353 | 128.25484580012417 |  4877.241711736944
  93 |       93 |     20297 |     717 |    88 |   156 | 121.44103572177873 |  5005.496557537068
  94 |       94 |     20297 |     717 |   702 |  1157 | 122.66748829699021 |  5126.937593258846
  95 |       95 |     20297 |     717 |   703 | 11370 | 44.416122235186464 | 5249.6050815558365
  96 |       96 |     20297 |     717 |  7674 | 11369 | 106.23996035701776 |  5294.021203791023
  97 |       97 |     20297 |     717 |   717 |    -1 |                  0 |  5400.261164148041
  98 |        1 |     23872 |     717 | 23872 | 32201 |  5.308421200756104 |                  0
  99 |        2 |     23872 |     717 | 13075 |  3157 |  28.35987013246756 |  5.308421200756104
 100 |        3 |     23872 |     717 |  1959 | 27731 | 16.461511529807836 | 33.668291333223664
 101 |        4 |     23872 |     717 | 21023 | 12148 |  121.9233601474855 |   50.1298028630315
 102 |        5 |     23872 |     717 |  8266 |  1650 | 27.193475090808942 | 172.05316301051698
 103 |        6 |     23872 |     717 |   981 | 12150 | 18.114313526124846 |  199.2466381013259
 104 |        7 |     23872 |     717 |  8268 | 13776 |  66.62813057910768 | 217.36095162745076
 105 |        8 |     23872 |     717 |  9563 | 26702 | 11.000675493633516 | 283.98908220655846
 106 |        9 |     23872 |     717 | 20053 |  1649 |  69.90037938719193 |   294.989757700192
 107 |       10 |     23872 |     717 |   980 | 27759 | 142.04202542472146 | 364.89013708738395
 108 |       11 |     23872 |     717 | 21058 |  1646 | 19.435729806674743 |  506.9321625121054
 109 |       12 |     23872 |     717 |   978 | 18330 | 137.59566611951342 |  526.3678923187802
 110 |       13 |     23872 |     717 | 13086 |   194 | 23.774443326206004 |  663.9635584382936
 111 |       14 |     23872 |     717 |   115 | 18333 |  25.48622813313921 |  687.7380017644996
 112 |       15 |     23872 |     717 | 13088 |  3203 | 139.95410643798533 |  713.2242298976388
 113 |       16 |     23872 |     717 |  1987 | 10373 |  149.7542153327793 |  853.1783363356242
 114 |       17 |     23872 |     717 |  6969 | 16507 |  17.96400313363855 | 1002.9325516684034
 115 |       18 |     23872 |     717 | 11677 | 16935 |  44.12002308211921 |  1020.896554802042
 116 |       19 |     23872 |     717 | 11991 | 18342 | 11.574081519905338 | 1065.0165778841613
 117 |       20 |     23872 |     717 | 13096 |  2709 | 12.207893086573405 | 1076.5906594040666
 118 |       21 |     23872 |     717 |  1668 | 21057 |  74.91386301573434 |   1088.79855249064
 119 |       22 |     23872 |     717 | 15117 | 18336 | 20.599962676135362 | 1163.7124155063743
 120 |       23 |     23872 |     717 | 13091 | 27191 |  79.77421436465274 | 1184.3123781825097
 121 |       24 |     23872 |     717 | 20539 | 12740 | 60.511035930043825 | 1264.0865925471626
 122 |       25 |     23872 |     717 |  8746 |   627 | 12.757478656304011 | 1324.5976284772064
 123 |       26 |     23872 |     717 |   368 | 15143 |  87.77110725683555 | 1337.3551071335105
 124 |       27 |     23872 |     717 | 10665 | 15144 | 22.735397512140214 | 1425.1262143903461
 125 |       28 |     23872 |     717 | 10666 | 26215 | 14.600900882769231 | 1447.8616119024864
 126 |       29 |     23872 |     717 | 19564 |  1403 |  75.91234257967707 | 1462.4625127852557
 127 |       30 |     23872 |     717 |   845 |  3231 |  53.27182155539072 | 1538.3748553649327
 128 |       31 |     23872 |     717 |  2008 | 27172 |  41.11072348474541 | 1591.6466769203234
 129 |       32 |     23872 |     717 | 20522 | 27174 |  45.64884913241146 |  1632.757400405069
 130 |       33 |     23872 |     717 | 20523 | 27175 |  20.14248196262777 | 1678.4062495374803
 131 |       34 |     23872 |     717 | 20524 | 27179 |  7.367019852535565 |  1698.548731500108
 132 |       35 |     23872 |     717 | 20527 | 27178 | 10.538633388463355 | 1705.9157513526436
 133 |       36 |     23872 |     717 | 20526 | 27177 | 13.643456241642502 | 1716.4543847411069
 134 |       37 |     23872 |     717 | 20525 | 13654 |  59.52070305619048 | 1730.0978409827494
 135 |       38 |     23872 |     717 |  9462 | 18921 |   25.8492753266664 |   1789.61854403894
 136 |       39 |     23872 |     717 | 13553 | 22261 |  52.67091021174296 | 1815.4678193656064
 137 |       40 |     23872 |     717 | 16118 |   680 | 54.653817894690704 | 1868.1387295773493
 138 |       41 |     23872 |     717 |   405 | 11307 | 103.03817777081665 |   1922.79254747204
 139 |       42 |     23872 |     717 |  7626 | 22264 |  32.38376767115676 | 2025.8307252428567
 140 |       43 |     23872 |     717 | 16120 | 18915 | 12.398869345141664 | 2058.2144929140136
 141 |       44 |     23872 |     717 | 13548 |   400 | 24.163445380983713 |  2070.613362259155
 142 |       45 |     23872 |     717 |   242 |  8111 |  79.52648400707797 |  2094.776807640139
 143 |       46 |     23872 |     717 |  5336 | 18920 |   57.4913918126638 |  2174.303291647217
 144 |       47 |     23872 |     717 | 13552 |   129 |  90.50476993879059 |  2231.794683459881
 145 |       48 |     23872 |     717 |    73 | 23872 |  116.9946105393222 | 2322.2994533986716
 146 |       49 |     23872 |     717 | 17545 |   133 | 198.25042291765976 |  2439.294063937994
 147 |       50 |     23872 |     717 |    75 |  8069 | 104.05989141865793 | 2637.5444868556538
 148 |       51 |     23872 |     717 |  5343 | 13553 |  46.03224565465761 |  2741.604378274312
 149 |       52 |     23872 |     717 |  9383 | 26190 |  77.81310755016504 | 2787.6366239289696
 150 |       53 |     23872 |     717 | 19540 | 20372 | 28.650170504732223 | 2865.4497314791347
 151 |       54 |     23872 |     717 | 14633 |  1209 | 108.17847762279627 |  2894.099901983867
 152 |       55 |     23872 |     717 |   730 |  8118 | 42.745588047040684 | 3002.2783796066633
 153 |       56 |     23872 |     717 |  5340 |  8120 | 19.235998339379215 |  3045.023967653704
 154 |       57 |     23872 |     717 |  5341 |  1407 |  70.29309962780896 | 3064.2599659930834
 155 |       58 |     23872 |     717 |   847 | 23627 |  66.41289654925802 | 3134.5530656208925
 156 |       59 |     23872 |     717 | 17326 |  1201 |  81.17542411044201 | 3200.9659621701508
 157 |       60 |     23872 |     717 |   725 |  1593 |  58.88701093682811 |  3282.141386280593
 158 |       61 |     23872 |     717 |   945 |  1188 |  69.99289425455481 |  3341.028397217421
 159 |       62 |     23872 |     717 |   719 |  1546 | 126.86492967286296 |  3411.021291471976
 160 |       63 |     23872 |     717 |   921 |  1185 | 132.53269452771102 |  3537.886221144839
 161 |       64 |     23872 |     717 |   718 |  1184 | 143.68954737758125 |   3670.41891567255
 162 |       65 |     23872 |     717 |   717 |    -1 |                  0 | 3814.1084630501314
(162 rows)

2.1.3. Exercise 3: Many Pedestrians departing from the same location

Problem:

  • Walking

    • from “Palacete Bolonha”

    • to “Hangar Convention Center” and “Instituto Federal do Pará, Campus Belém”

  • Calculate routes with costs in seconds.

../_images/pedestrian_route2.png

Solution:

  • All pedestrians are departing from vertex 717 (line 9).

  • Pedestrians want to go to locations 20297 and 23872 (line 10).

  • The cost to be in seconds, with a walking speed s = 1.3 m/s and t = d/s (line 6).

SELECT * FROM pgr_dijkstra(
  '
    SELECT gid AS id,
      source,
      target,
      length_m / 1.3 AS cost      -- line 6
    FROM ways
  ',
  717, -- line 9
  ARRAY[20297,23872], -- line 10
  directed := false);
 seq | path_seq | start_vid | end_vid | node  | edge  |        cost         |      agg_cost      
-----+----------+-----------+---------+-------+-------+---------------------+--------------------
   1 |        1 |       717 |   20297 |   717 | 11369 |    81.7230464284752 |                  0
   2 |        2 |       717 |   20297 |  7674 | 11370 |   34.16624787322036 |   81.7230464284752
   3 |        3 |       717 |   20297 |   703 |  1157 |   94.35960638230016 | 115.88929430169556
   4 |        4 |       717 |   20297 |   702 |   156 |   93.41618132444518 |  210.2489006839957
   5 |        5 |       717 |   20297 |    88 | 21353 |    98.6575736924032 |  303.6650820084409
   6 |        6 |       717 |   20297 | 15362 | 16610 |   71.22842218014499 |  402.3226557008441
   7 |        7 |       717 |   20297 | 11748 | 11111 |   8.940221207195687 |  473.5510778809891
   8 |        8 |       717 |   20297 |  7483 |   192 |   9.593907151391893 |  482.4912990881848
   9 |        9 |       717 |   20297 |   114 | 15091 |  10.273218098405486 |  492.0852062395767
  10 |       10 |       717 |   20297 | 10625 |  1202 |  10.380977135606122 | 502.35842433798217
  11 |       11 |       717 |   20297 |   726 | 26253 |   29.06093944575187 |  512.7394014735883
  12 |       12 |       717 |   20297 | 19603 | 21349 |   6.628919419548523 |  541.8003409193401
  13 |       13 |       717 |   20297 | 15358 | 23598 |  14.088461876030069 |  548.4292603388886
  14 |       14 |       717 |   20297 | 17298 | 15331 |  29.900247796483445 |  562.5177222149188
  15 |       15 |       717 |   20297 | 10814 |  1087 |   7.644113562306751 |  592.4179700114022
  16 |       16 |       717 |   20297 |   661 | 12537 |  12.348682112453377 |   600.062083573709
  17 |       17 |       717 |   20297 |  8577 | 15325 |  137.31719282918039 |  612.4107656861623
  18 |       18 |       717 |   20297 | 10810 |  1206 |    9.95169492092588 |  749.7279585153427
  19 |       19 |       717 |   20297 |   728 | 27782 |    67.1620443140389 |  759.6796534362686
  20 |       20 |       717 |   20297 | 21085 | 15323 |  2.6221219673384097 |  826.8416977503075
  21 |       21 |       717 |   20297 | 10808 | 27608 |   7.661437707619558 |   829.463819717646
  22 |       22 |       717 |   20297 | 20911 | 25545 |    63.5985668462561 |  837.1252574252655
  23 |       23 |       717 |   20297 | 18983 | 26695 |   48.73544837484111 |  900.7238242715216
  24 |       24 |       717 |   20297 | 20046 | 27783 |   79.78600243499491 |  949.4592726463627
  25 |       25 |       717 |   20297 | 21086 |   419 |   7.542110542234763 | 1029.2452750813577
  26 |       26 |       717 |   20297 |   251 | 13532 |    98.1145081955877 | 1036.7873856235924
  27 |       27 |       717 |   20297 |  9366 | 13530 |   69.45840874620015 |   1134.90189381918
  28 |       28 |       717 |   20297 |  9364 |   126 |  49.875680201477245 | 1204.3603025653802
  29 |       29 |       717 |   20297 |    72 | 26760 |  101.92155196327032 | 1254.2359827668574
  30 |       30 |       717 |   20297 | 20111 | 27615 |   87.17804445223827 | 1356.1575347301277
  31 |       31 |       717 |   20297 | 20914 | 18913 |  47.605088744756515 |  1443.335579182366
  32 |       32 |       717 |   20297 | 13547 |   796 |  43.387977106756054 | 1490.9406679271226
  33 |       33 |       717 |   20297 |   478 |   797 |   73.16222181958797 | 1534.3286450338787
  34 |       34 |       717 |   20297 | 14728 | 20507 |   34.27355124957916 | 1607.4908668534667
  35 |       35 |       717 |   20297 | 14731 | 20510 |   5.757436780693644 |  1641.764418103046
  36 |       36 |       717 |   20297 | 14729 | 20508 |  43.598422389920614 | 1647.5218548837397
  37 |       37 |       717 |   20297 | 14817 |  1096 |  2.3864674210486894 | 1691.1202772736603
  38 |       38 |       717 |   20297 |   666 | 18926 |  13.936400922815201 | 1693.5067446947091
  39 |       39 |       717 |   20297 | 13558 | 20632 | 0.49155840381386856 | 1707.4431456175244
  40 |       40 |       717 |   20297 | 14816 | 20527 |  130.78295067094484 | 1707.9347040213381
  41 |       41 |       717 |   20297 | 14743 | 20526 |    83.2890220226128 | 1838.7176546922828
  42 |       42 |       717 |   20297 | 14742 | 24808 |   41.46392001946075 | 1922.0066767148955
  43 |       43 |       717 |   20297 | 18349 | 24809 |   51.53753116293041 | 1963.4705967343564
  44 |       44 |       717 |   20297 | 18350 | 24810 |   42.63325343560407 | 2015.0081278972868
  45 |       45 |       717 |   20297 |   197 |   320 | 0.24839561297438223 |  2057.641381332891
  46 |       46 |       717 |   20297 | 17152 | 23450 |    76.1031299853279 | 2057.8897769458654
  47 |       47 |       717 |   20297 |    83 |   148 |   72.58272639292232 | 2133.9929069311934
  48 |       48 |       717 |   20297 |   971 |  1636 |   26.09340589989801 | 2206.5756333241156
  49 |       49 |       717 |   20297 |   966 |  1628 |  12.520668606841847 | 2232.6690392240134
  50 |       50 |       717 |   20297 | 16963 | 23247 |   78.48293013491863 | 2245.1897078308552
  51 |       51 |       717 |   20297 |   302 |   508 |  33.629655442019455 |  2323.672637965774
  52 |       52 |       717 |   20297 |  5227 |  7947 |  21.017870240428266 | 2357.3022934077935
  53 |       53 |       717 |   20297 |  6960 | 10359 |   8.526468834376512 | 2378.3201636482218
  54 |       54 |       717 |   20297 |  6769 | 10077 |   61.86985400066434 |  2386.846632482598
  55 |       55 |       717 |   20297 |   985 |  1657 |  102.81227691131562 | 2448.7164864832625
  56 |       56 |       717 |   20297 | 10804 | 15317 |  14.244889703802025 |  2551.528763394578
  57 |       57 |       717 |   20297 |  8264 | 12144 |  10.723626645285663 | 2565.7736530983802
  58 |       58 |       717 |   20297 |   983 |  1655 |   7.768648346204452 |  2576.497279743666
  59 |       59 |       717 |   20297 | 10800 | 15310 |  13.243839736073351 |   2584.26592808987
  60 |       60 |       717 |   20297 |  8261 | 12139 |   26.42153605510172 | 2597.5097678259435
  61 |       61 |       717 |   20297 | 13512 | 18872 |    69.1880160964778 |  2623.931303881045
  62 |       62 |       717 |   20297 | 13081 | 18324 |   9.842467512028971 |  2693.119319977523
  63 |       63 |       717 |   20297 |  2022 |  3255 |   7.270758810692955 |  2702.961787489552
  64 |       64 |       717 |   20297 | 13078 | 18321 |   33.24564179223615 |  2710.232546300245
  65 |       65 |       717 |   20297 | 13514 | 18875 |   32.03818547411845 |  2743.478188092481
  66 |       66 |       717 |   20297 | 13516 | 18878 |   35.23822546512615 | 2775.5163735665997
  67 |       67 |       717 |   20297 | 10797 | 15305 |   16.64133756443146 |  2810.754599031726
  68 |       68 |       717 |   20297 |  2023 |  3256 |   54.96213990925918 | 2827.3959365961573
  69 |       69 |       717 |   20297 |  7366 | 10935 |   5.234083591847118 | 2882.3580765054166
  70 |       70 |       717 |   20297 |  9581 | 13799 |   58.82994198931749 |  2887.592160097264
  71 |       71 |       717 |   20297 | 10796 | 15304 |   8.641716850936044 |  2946.422102086581
  72 |       72 |       717 |   20297 |  2040 |  3285 |  32.264472556056916 |  2955.063818937517
  73 |       73 |       717 |   20297 | 20647 | 27297 |  41.093252826979096 |  2987.328291493574
  74 |       74 |       717 |   20297 |  9580 | 13798 |   35.53553713126484 |  3028.421544320553
  75 |       75 |       717 |   20297 | 10791 | 15295 |    18.2265286153021 |  3063.957081451818
  76 |       76 |       717 |   20297 |   226 |   375 |  21.141859121862286 |   3082.18361006712
  77 |       77 |       717 |   20297 | 10787 | 15288 |  103.83471305614356 |  3103.325469188982
  78 |       78 |       717 |   20297 |  6991 | 10411 |   6.389600635835032 | 3207.1601822451257
  79 |       79 |       717 |   20297 |  6990 | 10409 |    8.19288799902708 | 3213.5497828809607
  80 |       80 |       717 |   20297 |  7234 | 10752 |   72.21882764683761 | 3221.7426708799876
  81 |       81 |       717 |   20297 | 10784 | 15283 |   42.43004422529759 | 3293.9614985268254
  82 |       82 |       717 |   20297 |   333 |   565 |  103.42166183305292 |  3336.391542752123
  83 |       83 |       717 |   20297 |  6955 | 10350 |  14.725890329138844 | 3439.8132045851758
  84 |       84 |       717 |   20297 | 21149 | 27845 |   8.566149926268713 |  3454.539094914315
  85 |       85 |       717 |   20297 |   320 |   540 |   9.070019304679219 | 3463.1052448405835
  86 |       86 |       717 |   20297 | 21151 | 27847 |  12.906586411718221 | 3472.1752641452626
  87 |       87 |       717 |   20297 |  6953 | 10346 |  107.10265978912945 |  3485.081850556981
  88 |       88 |       717 |   20297 |  1022 |  1725 |   47.39231326387398 | 3592.1845103461105
  89 |       89 |       717 |   20297 |  7361 | 10927 |   76.78594111981243 | 3639.5768236099843
  90 |       90 |       717 |   20297 |  1084 |  1835 |   52.45469946819912 | 3716.3627647297967
  91 |       91 |       717 |   20297 |  7357 | 10920 |   79.17316882299227 |  3768.817464197996
  92 |       92 |       717 |   20297 |  1051 |  1775 |   129.0645796686789 | 3847.9906330209883
  93 |       93 |       717 |   20297 |  1033 |  1743 |  122.06445826420739 | 3977.0552126896673
  94 |       94 |       717 |   20297 |  7354 | 10915 |  30.436236647378845 |  4099.119670953874
  95 |       95 |       717 |   20297 |    54 |    91 |   9.837892863280453 |  4129.555907601253
  96 |       96 |       717 |   20297 | 20296 | 31885 |   14.65324888011387 |  4139.393800464533
  97 |       97 |       717 |   20297 | 20297 |    -1 |                   0 |  4154.047049344647
  98 |        1 |       717 |   23872 |   717 |  1184 |  110.53042105967788 |                  0
  99 |        2 |       717 |   23872 |   718 |  1185 |   101.9482265597777 | 110.53042105967788
 100 |        3 |       717 |   23872 |   921 |  1546 |   97.58840744066381 | 212.47864761945556
 101 |        4 |       717 |   23872 |   719 |  1188 |  53.840687888119085 |  310.0670550601194
 102 |        5 |       717 |   23872 |   945 |  1593 |   45.29770072063701 |  363.9077429482385
 103 |        6 |       717 |   23872 |   725 |  1201 |  62.442633931109235 |  409.2054436688755
 104 |        7 |       717 |   23872 | 17326 | 23627 |   51.08684349942924 | 471.64807759998473
 105 |        8 |       717 |   23872 |   847 |  1407 |   54.07161509831458 |   522.734921099414
 106 |        9 |       717 |   23872 |  5341 |  8120 |  14.796921799522472 |  576.8065361977286
 107 |       10 |       717 |   23872 |  5340 |  8118 |   32.88122157464668 |  591.6034579972511
 108 |       11 |       717 |   23872 |   730 |  1209 |   83.21421355599712 |  624.4846795718978
 109 |       12 |       717 |   23872 | 14633 | 20372 |  22.038592695947862 |   707.698893127895
 110 |       13 |       717 |   23872 | 19540 | 26190 |   59.85623657705003 |  729.7374858238428
 111 |       14 |       717 |   23872 |  9383 | 13553 |   35.40941973435201 |  789.5937224008928
 112 |       15 |       717 |   23872 |  5343 |  8069 |   80.04607032204456 |  825.0031421352448
 113 |       16 |       717 |   23872 |    75 |   133 |  152.50032532127673 |  905.0492124572894
 114 |       17 |       717 |   23872 | 17545 | 23872 |   89.99585426101707 | 1057.5495377785662
 115 |       18 |       717 |   23872 |    73 |   129 |   69.61905379906968 | 1147.5453920395832
 116 |       19 |       717 |   23872 | 13552 | 18920 |   44.22414754820292 |  1217.164445838653
 117 |       20 |       717 |   23872 |  5336 |  8111 |   61.17421846698305 | 1261.3885933868557
 118 |       21 |       717 |   23872 |   242 |   400 |  18.587265677679778 | 1322.5628118538389
 119 |       22 |       717 |   23872 | 13548 | 18915 |   9.537591803955126 | 1341.1500775315187
 120 |       23 |       717 |   23872 | 16120 | 22264 |  24.910590516274432 | 1350.6876693354739
 121 |       24 |       717 |   23872 |  7626 | 11307 |   79.26013674678204 | 1375.5982598517483
 122 |       25 |       717 |   23872 |   405 |   680 |   42.04139838053131 | 1454.8583965985304
 123 |       26 |       717 |   23872 | 16118 | 22261 |   40.51608477826381 | 1496.8997949790617
 124 |       27 |       717 |   23872 | 13553 | 18921 |   19.88405794358954 | 1537.4158797573255
 125 |       28 |       717 |   23872 |  9462 | 13654 |    45.7851561970696 |  1557.299937700915
 126 |       29 |       717 |   23872 | 20525 | 27177 |  10.494966339725002 | 1603.0850938979847
 127 |       30 |       717 |   23872 | 20526 | 27178 |   8.106641068048734 | 1613.5800602377096
 128 |       31 |       717 |   23872 | 20527 | 27179 |  5.6669383481042805 | 1621.6867013057583
 129 |       32 |       717 |   23872 | 20524 | 27175 |  15.494216894329053 | 1627.3536396538625
 130 |       33 |       717 |   23872 | 20523 | 27174 |    35.1144993326242 | 1642.8478565481917
 131 |       34 |       717 |   23872 | 20522 | 27172 |  31.623633449804156 |  1677.962355880816
 132 |       35 |       717 |   23872 |  2008 |  3231 |  40.978324273377474 | 1709.5859893306201
 133 |       36 |       717 |   23872 |   845 |  1403 |   58.39410967667467 | 1750.5643136039976
 134 |       37 |       717 |   23872 | 19564 | 26215 |  11.231462217514792 | 1808.9584232806722
 135 |       38 |       717 |   23872 | 10666 | 15144 |  17.488767317030934 | 1820.1898854981869
 136 |       39 |       717 |   23872 | 10665 | 15143 |   67.51623635141196 |  1837.678652815218
 137 |       40 |       717 |   23872 |   368 |   627 |   9.813445120233855 | 1905.1948891666298
 138 |       41 |       717 |   23872 |  8746 | 12740 |  46.546950715418326 | 1915.0083342868636
 139 |       42 |       717 |   23872 | 20539 | 27191 |    61.3647802805021 | 1961.5552850022818
 140 |       43 |       717 |   23872 | 13091 | 18336 |   15.84612513548874 |  2022.920065282784
 141 |       44 |       717 |   23872 | 15117 | 21057 |  57.626048473641795 | 2038.7661904182728
 142 |       45 |       717 |   23872 |  1668 |  2709 |   9.390686989671849 | 2096.3922388919145
 143 |       46 |       717 |   23872 | 13096 | 18342 |   8.903139630696414 | 2105.7829258815864
 144 |       47 |       717 |   23872 | 11991 | 16935 |   33.93847929393785 | 2114.6860655122828
 145 |       48 |       717 |   23872 | 11677 | 16507 |   13.81846394895273 | 2148.6245448062205
 146 |       49 |       717 |   23872 |  6969 | 10373 |  115.19555025598407 |  2162.443008755173
 147 |       50 |       717 |   23872 |  1987 |  3203 |   107.6570049522964 |  2277.638559011157
 148 |       51 |       717 |   23872 | 13088 | 18333 |  19.604790871645545 |  2385.295563963454
 149 |       52 |       717 |   23872 |   115 |   194 |  18.288033327850773 | 2404.9003548350993
 150 |       53 |       717 |   23872 | 13086 | 18330 |   105.8428200919334 |   2423.18838816295
 151 |       54 |       717 |   23872 |   978 |  1646 |  14.950561389749803 | 2529.0312082548835
 152 |       55 |       717 |   23872 | 21058 | 27759 |  109.26309648055496 | 2543.9817696446335
 153 |       56 |       717 |   23872 |   980 |  1649 |   53.76952260553225 | 2653.2448661251883
 154 |       57 |       717 |   23872 | 20053 | 26702 |   8.462058072025782 | 2707.0143887307204
 155 |       58 |       717 |   23872 |  9563 | 13776 |  51.252408137775134 |  2715.476446802746
 156 |       59 |       717 |   23872 |  8268 | 12150 |  13.934087327788342 |  2766.728854940521
 157 |       60 |       717 |   23872 |   981 |  1650 |  20.918057762160725 | 2780.6629422683095
 158 |       61 |       717 |   23872 |  8266 | 12148 |   93.78720011345038 |   2801.58100003047
 159 |       62 |       717 |   23872 | 21023 | 27731 |  12.662701176775258 | 2895.3682001439206
 160 |       63 |       717 |   23872 |  1959 |  3157 |  21.815284717282736 | 2908.0309013206956
 161 |       64 |       717 |   23872 | 13075 | 32201 |   4.083400923658542 | 2929.8461860379784
 162 |       65 |       717 |   23872 | 23872 |    -1 |                   0 |  2933.929586961637
(162 rows)

2.1.4. Exercise 4: Many Pedestrians going to different destinations

Problem:

  • Walking

    • from “Hangar Convention Center” and “Instituto Federal do Pará, Campus Belém”

    • to “Forte do Castelo” and “Estação das Docas”

  • Calculate routes with costs in minutes.

../_images/pedestrian_route4.png

Solution:

  • The pedestrians depart from 20297 and 23872 (line 9).

  • The pedestrians want to go to destinations 6548 and 12712 (line 10).

  • The cost to be in minutes, with a walking speed s = 1.3 m/s and t = d/s (line 6).

  • Result adds the costs per destination.

SELECT * FROM pgr_dijkstra(
  '
    SELECT gid AS id,
      source,
      target,
      length_m / 1.3 / 60 AS cost -- line 6
    FROM ways
  ',
  ARRAY[20297, 23872], -- line 9
  ARRAY[6548, 12712], -- line 10
  directed := false);
 seq | path_seq | start_vid | end_vid | node  | edge  |         cost          |      agg_cost       
-----+----------+-----------+---------+-------+-------+-----------------------+---------------------
   1 |        1 |     20297 |    6548 | 20297 | 31885 |    0.2442208146685645 |                   0
   2 |        2 |     20297 |    6548 | 20296 |    91 |   0.16396488105467422 |  0.2442208146685645
   3 |        3 |     20297 |    6548 |    54 | 10915 |    0.5072706107896474 |  0.4081856957232387
   4 |        4 |     20297 |    6548 |  7354 |  1743 |      2.03440763773679 |  0.9154563065128861
   5 |        5 |     20297 |    6548 |  1033 |  1775 |     2.151076327811315 |   2.949863944249676
   6 |        6 |     20297 |    6548 |  1051 | 10920 |    1.3195528137165378 |   5.100940272060991
   7 |        7 |     20297 |    6548 |  7357 |  1835 |     0.874244991136652 |   6.420493085777529
   8 |        8 |     20297 |    6548 |  1084 | 10927 |    1.2797656853302073 |  7.2947380769141805
   9 |        9 |     20297 |    6548 |  7361 |  1725 |     0.789871887731233 |   8.574503762244388
  10 |       10 |     20297 |    6548 |  1022 | 10346 |     1.785044329818824 |    9.36437564997562
  11 |       11 |     20297 |    6548 |  6953 | 27847 |   0.21510977352863703 |  11.149419979794445
  12 |       12 |     20297 |    6548 | 21151 |   540 |    0.1511669884113203 |  11.364529753323081
  13 |       13 |     20297 |    6548 |   320 | 27845 |   0.14276916543781187 |  11.515696741734402
  14 |       14 |     20297 |    6548 | 21149 | 10350 |    0.2454315054856474 |  11.658465907172214
  15 |       15 |     20297 |    6548 |  6955 |   565 |    1.7236943638842155 |  11.903897412657862
  16 |       16 |     20297 |    6548 |   333 | 15283 |    0.7071674037549599 |  13.627591776542078
  17 |       17 |     20297 |    6548 | 10784 | 10752 |    1.2036471274472935 |  14.334759180297038
  18 |       18 |     20297 |    6548 |  7234 | 10409 |   0.13654813331711801 |  15.538406307744332
  19 |       19 |     20297 |    6548 |  6990 | 10411 |   0.10649334393058388 |   15.67495444106145
  20 |       20 |     20297 |    6548 |  6991 | 15288 |    1.7305785509357259 |  15.781447784992034
  21 |       21 |     20297 |    6548 | 10787 |   375 |   0.35236431869770474 |   17.51202633592776
  22 |       22 |     20297 |    6548 |   226 | 15295 |    0.3037754769217017 |  17.864390654625467
  23 |       23 |     20297 |    6548 | 10791 | 13798 |    0.5922589521877473 |  18.168166131547167
  24 |       24 |     20297 |    6548 |  9580 | 27297 |    0.6848875471163183 |  18.760425083734916
  25 |       25 |     20297 |    6548 | 20647 |  3285 |    0.5377412092676153 |  19.445312630851234
  26 |       26 |     20297 |    6548 |  2040 | 15304 |    0.1440286141822674 |   19.98305384011885
  27 |       27 |     20297 |    6548 | 10796 | 13799 |    0.9804990331552915 |  20.127082454301117
  28 |       28 |     20297 |    6548 |  9581 | 10935 |    0.0872347265307853 |  21.107581487456407
  29 |       29 |     20297 |    6548 |  7366 |  3256 |    0.9160356651543197 |  21.194816213987192
  30 |       30 |     20297 |    6548 |  2023 | 15305 |   0.27735562607385766 |   22.11085187914151
  31 |       31 |     20297 |    6548 | 10797 | 18878 |    0.5873037577521025 |   22.38820750521537
  32 |       32 |     20297 |    6548 | 13516 | 18875 |    0.5339697579019742 |  22.975511262967473
  33 |       33 |     20297 |    6548 | 13514 | 18321 |    0.5540940298706025 |  23.509481020869448
  34 |       34 |     20297 |    6548 | 13078 |  3255 |   0.12117931351154926 |   24.06357505074005
  35 |       35 |     20297 |    6548 |  2022 | 18324 |   0.16404112520048286 |    24.1847543642516
  36 |       36 |     20297 |    6548 | 13081 | 18872 |    1.1531336016079632 |  24.348795489452083
  37 |       37 |     20297 |    6548 | 13512 | 12139 |    0.4403589342516953 |  25.501929091060045
  38 |       38 |     20297 |    6548 |  8261 | 15310 |   0.22073066226788918 |   25.94228802531174
  39 |       39 |     20297 |    6548 | 10800 |  1655 |   0.12947747243674088 |   26.16301868757963
  40 |       40 |     20297 |    6548 |   983 | 12144 |   0.17872711075476105 |   26.29249616001637
  41 |       41 |     20297 |    6548 |  8264 | 15317 |   0.23741482839670042 |   26.47122327077113
  42 |       42 |     20297 |    6548 | 10804 |  1657 |     1.713537948521927 |  26.708638099167832
  43 |       43 |     20297 |    6548 |   985 | 10077 |    1.0311642333444058 |   28.42217604768976
  44 |       44 |     20297 |    6548 |  6769 | 10359 |    0.1421078139062752 |  29.453340281034166
  45 |       45 |     20297 |    6548 |  6960 |  7947 |    0.3502978373404711 |   29.59544809494044
  46 |       46 |     20297 |    6548 |  5227 |   508 |    0.5604942573669909 |   29.94574593228091
  47 |       47 |     20297 |    6548 |   302 | 23247 |    1.3080488355819773 |    30.5062401896479
  48 |       48 |     20297 |    6548 | 16963 |  1628 |   0.20867781011403078 |   31.81428902522988
  49 |       49 |     20297 |    6548 |   966 |  1636 |    0.4348900983316335 |   32.02296683534391
  50 |       50 |     20297 |    6548 |   971 |   148 |    1.2097121065487053 |  32.457856933675544
  51 |       51 |     20297 |    6548 |    83 | 23450 |    1.2683854997554649 |   33.66756904022425
  52 |       52 |     20297 |    6548 | 17152 |   320 |  0.004139926882906371 |   34.93595453997972
  53 |       53 |     20297 |    6548 |   197 | 24810 |    0.7105542239267345 |  34.940094466862625
  54 |       54 |     20297 |    6548 | 18350 | 20586 |   0.13057016468240487 |   35.65064869078936
  55 |       55 |     20297 |    6548 | 14785 | 20587 |   0.03766657553494008 |  35.781218855471764
  56 |       56 |     20297 |    6548 | 14786 | 20524 |   0.38813765244320864 |  35.818885431006706
  57 |       57 |     20297 |    6548 | 14741 | 23244 |     1.322640874134927 |   36.20702308344991
  58 |       58 |     20297 |    6548 | 16961 | 20514 |    2.0031720750401316 |   37.52966395758484
  59 |       59 |     20297 |    6548 | 14734 | 20515 | 0.0023002978546155174 |   39.53283603262497
  60 |       60 |     20297 |    6548 | 14735 | 20512 |  0.004620211162270131 |   39.53513633047959
  61 |       61 |     20297 |    6548 | 14733 | 20518 |   0.31469391309389133 |   39.53975654164186
  62 |       62 |     20297 |    6548 | 14737 | 20517 | 0.0066601968648225115 |   39.85445045473575
  63 |       63 |     20297 |    6548 | 14736 | 20519 |  0.018903908480070467 |   39.86111065160057
  64 |       64 |     20297 |    6548 | 14738 | 20640 |     1.653073770861454 |   39.88001456008064
  65 |       65 |     20297 |    6548 | 14820 | 26468 |    0.9359532628010392 |   41.53308833094209
  66 |       66 |     20297 |    6548 | 19819 | 12983 |    0.5167283502788157 |   42.46904159374313
  67 |       67 |     20297 |    6548 |  8935 |   124 |    1.9083968045578925 |  42.985769944021946
  68 |       68 |     20297 |    6548 |    71 | 26609 |     1.583131917086152 |   44.89416674857984
  69 |       69 |     20297 |    6548 | 19960 | 26500 |     1.291805691229554 |   46.47729866566599
  70 |       70 |     20297 |    6548 | 19851 |   421 |    0.3748799768698678 |   47.76910435689555
  71 |       71 |     20297 |    6548 |   252 | 27605 |    3.3742403272743378 |   48.14398433376542
  72 |       72 |     20297 |    6548 | 20909 |   123 |    1.1593486691102832 |   51.51822466103975
  73 |       73 |     20297 |    6548 |    70 | 17309 |    1.4955334679100953 |   52.67757333015004
  74 |       74 |     20297 |    6548 | 12290 | 26115 |   0.21936536742091248 |   54.17310679806013
  75 |       75 |     20297 |    6548 | 19464 | 22239 |    0.5976036284362439 |  54.392472165481045
  76 |       76 |     20297 |    6548 | 16097 | 13567 |    0.5306644753951875 |   54.99007579391729
  77 |       77 |     20297 |    6548 |  9393 |   495 |    0.8660799751880711 |  55.520740269312476
  78 |       78 |     20297 |    6548 |   295 | 22241 |    0.8373798376215448 |   56.38682024450055
  79 |       79 |     20297 |    6548 | 16099 | 22240 |   0.21240080265253497 |  57.224200082122096
  80 |       80 |     20297 |    6548 | 16098 | 25779 |     1.714828985506206 |   57.43660088477463
  81 |       81 |     20297 |    6548 | 19167 |   491 |   0.05901732549686001 |  59.151429870280836
  82 |       82 |     20297 |    6548 |   293 | 25793 |   0.10568511095728741 |    59.2104471957777
  83 |       83 |     20297 |    6548 | 19175 | 25730 |  0.014484151152383405 |  59.316132306734985
  84 |       84 |     20297 |    6548 | 19132 | 25731 |    0.1731887873430192 |  59.330616457887366
  85 |       85 |     20297 |    6548 | 19133 | 25792 |   0.04399689702387814 |   59.50380524523039
  86 |       86 |     20297 |    6548 | 19174 |  1150 |   0.05933636846802722 |   59.54780214225427
  87 |       87 |     20297 |    6548 |   698 | 11107 |   0.17374282311946126 |  59.607138510722294
  88 |       88 |     20297 |    6548 |  7481 | 16637 |    0.1857603022223164 |  59.780881333841755
  89 |       89 |     20297 |    6548 | 11766 | 21359 |    1.7430878754564423 |   59.96664163606407
  90 |       90 |     20297 |    6548 | 15367 | 15072 |    1.0925842217158432 |   61.70972951152051
  91 |       91 |     20297 |    6548 | 10611 |  1170 |    1.5690635162987887 |   62.80231373323635
  92 |       92 |     20297 |    6548 |   709 |  1168 |    1.5570199847118493 |   64.37137724953514
  93 |       93 |     20297 |    6548 |   708 |  1161 |    3.1706330870317943 |   65.92839723424699
  94 |       94 |     20297 |    6548 |   705 | 21116 |    1.2315680166184089 |   69.09903032127878
  95 |       95 |     20297 |    6548 | 15156 | 21118 |    0.0332524363091896 |   70.33059833789719
  96 |       96 |     20297 |    6548 | 15157 | 21119 |  0.017129604719012113 |   70.36385077420637
  97 |       97 |     20297 |    6548 | 20505 | 27154 |  0.027105494272354376 |   70.38098037892539
  98 |       98 |     20297 |    6548 | 11807 | 16736 |   0.09150495785271036 |   70.40808587319773
  99 |       99 |     20297 |    6548 | 11838 | 16735 |   0.23862498070176494 |   70.49959083105044
 100 |      100 |     20297 |    6548 | 11836 | 16733 |    0.2081188811279414 |   70.73821581175221
 101 |      101 |     20297 |    6548 | 11831 | 16727 |    0.4216864040282573 |   70.94633469288016
 102 |      102 |     20297 |    6548 | 20498 | 27147 |   0.02933617597188901 |   71.36802109690842
 103 |      103 |     20297 |    6548 | 11815 | 16707 |  0.027916135868862536 |   71.39735727288031
 104 |      104 |     20297 |    6548 | 20500 | 27149 |   0.31674103134200915 |   71.42527340874918
 105 |      105 |     20297 |    6548 | 11814 | 16705 |   0.13309805893880447 |   71.74201444009118
 106 |      106 |     20297 |    6548 | 11222 | 15890 |     0.312047910869037 |   71.87511249902998
 107 |      107 |     20297 |    6548 | 11219 | 16741 |    0.1929892180658986 |   72.18716040989902
 108 |      108 |     20297 |    6548 | 11844 | 27162 |    0.3735261999253613 |   72.38014962796493
 109 |      109 |     20297 |    6548 | 20513 | 28355 |    0.1862882866502802 |   72.75367582789029
 110 |      110 |     20297 |    6548 | 20514 | 28356 |    0.2100380064430438 |   72.93996411454057
 111 |      111 |     20297 |    6548 | 20515 | 16768 |   0.12412875211514746 |   73.15000212098361
 112 |      112 |     20297 |    6548 | 11864 | 31923 |   0.05522082894237899 |   73.27413087309876
 113 |      113 |     20297 |    6548 | 23006 | 31859 |    0.2041036869863129 |   73.32935170204114
 114 |      114 |     20297 |    6548 | 11877 | 31860 |   0.08763596168887573 |   73.53345538902745
 115 |      115 |     20297 |    6548 | 20448 | 27097 |   0.08367222126577643 |   73.62109135071633
 116 |      116 |     20297 |    6548 | 11862 | 10184 |   0.14722268073091993 |    73.7047635719821
 117 |      117 |     20297 |    6548 |  6847 |  1481 |    0.6383275468683184 |   73.85198625271302
 118 |      118 |     20297 |    6548 |   886 |  1442 |    1.4571273828152245 |   74.49031379958134
 119 |      119 |     20297 |    6548 |   867 |  1440 |    0.8210564579154069 |   75.94744118239657
 120 |      120 |     20297 |    6548 |   866 |  1420 |     1.039363969681231 |   76.76849764031198
 121 |      121 |     20297 |    6548 |   855 |  1418 |    0.9730075482588322 |   77.80786160999321
 122 |      122 |     20297 |    6548 |   854 | 25659 |    0.4015272779257525 |   78.78086915825205
 123 |      123 |     20297 |    6548 | 19077 |  1414 |    0.9281911182398142 |    79.1823964361778
 124 |      124 |     20297 |    6548 |   852 | 18518 |    1.0630019360185363 |    80.1105875544176
 125 |      125 |     20297 |    6548 | 13229 | 18519 |    0.9552289666901567 |   81.17358949043614
 126 |      126 |     20297 |    6548 | 13227 | 18515 |    1.1559405960346478 |    82.1288184571263
 127 |      127 |     20297 |    6548 | 12703 | 17825 |   0.03555036611124576 |   83.28475905316095
 128 |      128 |     20297 |    6548 |  7261 | 10798 |    0.9975859632821131 |    83.3203094192722
 129 |      129 |     20297 |    6548 |   893 |  1492 |    1.4031344334215368 |   84.31789538255433
 130 |      130 |     20297 |    6548 |  6851 | 10192 |    1.5701364203847021 |   85.72102981597587
 131 |      131 |     20297 |    6548 |  6853 | 10196 |   0.28953913067174697 |   87.29116623636057
 132 |      132 |     20297 |    6548 |  7228 | 27023 |   0.19879925415989355 |   87.58070536703231
 133 |      133 |     20297 |    6548 | 20376 | 27051 |    0.6494372977886846 |    87.7795046211922
 134 |      134 |     20297 |    6548 | 20403 | 19755 |    0.2275298400422538 |   88.42894191898088
 135 |      135 |     20297 |    6548 | 14206 | 19711 |    0.9220587215680605 |   88.65647175902313
 136 |      136 |     20297 |    6548 | 14174 | 17832 |   0.21640993474988235 |    89.5785304805912
 137 |      137 |     20297 |    6548 | 12710 | 19741 |    0.3201268812552062 |   89.79494041534107
 138 |      138 |     20297 |    6548 | 14195 | 19743 |   0.49508260952955185 |   90.11506729659628
 139 |      139 |     20297 |    6548 | 14196 | 19744 |   0.48439496686567235 |   90.61014990612583
 140 |      140 |     20297 |    6548 | 14197 | 19745 |    0.4169018723910478 |    91.0945448729915
 141 |      141 |     20297 |    6548 | 14198 |  9813 |    0.1808437523641115 |   91.51144674538256
 142 |      142 |     20297 |    6548 |  6562 | 15879 |   0.02937298113632556 |   91.69229049774667
 143 |      143 |     20297 |    6548 | 11211 |  9805 |   0.21298179959991656 |   91.72166347888299
 144 |      144 |     20297 |    6548 |  6558 |  9800 |     0.521207020386025 |    91.9346452784829
 145 |      145 |     20297 |    6548 |  6555 | 27063 |  0.026989071884391005 |   92.45585229886893
 146 |      146 |     20297 |    6548 | 20413 |  9792 |   0.09676253961561734 |   92.48284137075332
 147 |      147 |     20297 |    6548 |  6548 |    -1 |                     0 |   92.57960391036893
 148 |        1 |     20297 |   12712 | 20297 | 31885 |    0.2442208146685645 |                   0
 149 |        2 |     20297 |   12712 | 20296 |    91 |   0.16396488105467422 |  0.2442208146685645
 150 |        3 |     20297 |   12712 |    54 | 10915 |    0.5072706107896474 |  0.4081856957232387
 151 |        4 |     20297 |   12712 |  7354 |  1743 |      2.03440763773679 |  0.9154563065128861
 152 |        5 |     20297 |   12712 |  1033 |  1775 |     2.151076327811315 |   2.949863944249676
 153 |        6 |     20297 |   12712 |  1051 | 10920 |    1.3195528137165378 |   5.100940272060991
 154 |        7 |     20297 |   12712 |  7357 |  1835 |     0.874244991136652 |   6.420493085777529
 155 |        8 |     20297 |   12712 |  1084 | 10927 |    1.2797656853302073 |  7.2947380769141805
 156 |        9 |     20297 |   12712 |  7361 |  1725 |     0.789871887731233 |   8.574503762244388
 157 |       10 |     20297 |   12712 |  1022 | 10346 |     1.785044329818824 |    9.36437564997562
 158 |       11 |     20297 |   12712 |  6953 | 27847 |   0.21510977352863703 |  11.149419979794445
 159 |       12 |     20297 |   12712 | 21151 |   540 |    0.1511669884113203 |  11.364529753323081
 160 |       13 |     20297 |   12712 |   320 | 27845 |   0.14276916543781187 |  11.515696741734402
 161 |       14 |     20297 |   12712 | 21149 | 10350 |    0.2454315054856474 |  11.658465907172214
 162 |       15 |     20297 |   12712 |  6955 |   565 |    1.7236943638842155 |  11.903897412657862
 163 |       16 |     20297 |   12712 |   333 | 15283 |    0.7071674037549599 |  13.627591776542078
 164 |       17 |     20297 |   12712 | 10784 | 10752 |    1.2036471274472935 |  14.334759180297038
 165 |       18 |     20297 |   12712 |  7234 | 10409 |   0.13654813331711801 |  15.538406307744332
 166 |       19 |     20297 |   12712 |  6990 | 10411 |   0.10649334393058388 |   15.67495444106145
 167 |       20 |     20297 |   12712 |  6991 | 15288 |    1.7305785509357259 |  15.781447784992034
 168 |       21 |     20297 |   12712 | 10787 |   375 |   0.35236431869770474 |   17.51202633592776
 169 |       22 |     20297 |   12712 |   226 | 15295 |    0.3037754769217017 |  17.864390654625467
 170 |       23 |     20297 |   12712 | 10791 | 13798 |    0.5922589521877473 |  18.168166131547167
 171 |       24 |     20297 |   12712 |  9580 | 27297 |    0.6848875471163183 |  18.760425083734916
 172 |       25 |     20297 |   12712 | 20647 |  3285 |    0.5377412092676153 |  19.445312630851234
 173 |       26 |     20297 |   12712 |  2040 | 15304 |    0.1440286141822674 |   19.98305384011885
 174 |       27 |     20297 |   12712 | 10796 | 13799 |    0.9804990331552915 |  20.127082454301117
 175 |       28 |     20297 |   12712 |  9581 | 10935 |    0.0872347265307853 |  21.107581487456407
 176 |       29 |     20297 |   12712 |  7366 |  3256 |    0.9160356651543197 |  21.194816213987192
 177 |       30 |     20297 |   12712 |  2023 | 15305 |   0.27735562607385766 |   22.11085187914151
 178 |       31 |     20297 |   12712 | 10797 | 18878 |    0.5873037577521025 |   22.38820750521537
 179 |       32 |     20297 |   12712 | 13516 | 18875 |    0.5339697579019742 |  22.975511262967473
 180 |       33 |     20297 |   12712 | 13514 | 18321 |    0.5540940298706025 |  23.509481020869448
 181 |       34 |     20297 |   12712 | 13078 |  3255 |   0.12117931351154926 |   24.06357505074005
 182 |       35 |     20297 |   12712 |  2022 | 18324 |   0.16404112520048286 |    24.1847543642516
 183 |       36 |     20297 |   12712 | 13081 | 18872 |    1.1531336016079632 |  24.348795489452083
 184 |       37 |     20297 |   12712 | 13512 | 12139 |    0.4403589342516953 |  25.501929091060045
 185 |       38 |     20297 |   12712 |  8261 | 15310 |   0.22073066226788918 |   25.94228802531174
 186 |       39 |     20297 |   12712 | 10800 |  1655 |   0.12947747243674088 |   26.16301868757963
 187 |       40 |     20297 |   12712 |   983 | 12144 |   0.17872711075476105 |   26.29249616001637
 188 |       41 |     20297 |   12712 |  8264 | 15317 |   0.23741482839670042 |   26.47122327077113
 189 |       42 |     20297 |   12712 | 10804 |  1657 |     1.713537948521927 |  26.708638099167832
 190 |       43 |     20297 |   12712 |   985 | 10077 |    1.0311642333444058 |   28.42217604768976
 191 |       44 |     20297 |   12712 |  6769 | 10359 |    0.1421078139062752 |  29.453340281034166
 192 |       45 |     20297 |   12712 |  6960 |  7947 |    0.3502978373404711 |   29.59544809494044
 193 |       46 |     20297 |   12712 |  5227 |   508 |    0.5604942573669909 |   29.94574593228091
 194 |       47 |     20297 |   12712 |   302 | 23247 |    1.3080488355819773 |    30.5062401896479
 195 |       48 |     20297 |   12712 | 16963 |  1628 |   0.20867781011403078 |   31.81428902522988
 196 |       49 |     20297 |   12712 |   966 |  1636 |    0.4348900983316335 |   32.02296683534391
 197 |       50 |     20297 |   12712 |   971 |   148 |    1.2097121065487053 |  32.457856933675544
 198 |       51 |     20297 |   12712 |    83 | 23450 |    1.2683854997554649 |   33.66756904022425
 199 |       52 |     20297 |   12712 | 17152 |   320 |  0.004139926882906371 |   34.93595453997972
 200 |       53 |     20297 |   12712 |   197 | 24810 |    0.7105542239267345 |  34.940094466862625
 201 |       54 |     20297 |   12712 | 18350 | 20586 |   0.13057016468240487 |   35.65064869078936
 202 |       55 |     20297 |   12712 | 14785 | 20587 |   0.03766657553494008 |  35.781218855471764
 203 |       56 |     20297 |   12712 | 14786 | 20524 |   0.38813765244320864 |  35.818885431006706
 204 |       57 |     20297 |   12712 | 14741 | 23244 |     1.322640874134927 |   36.20702308344991
 205 |       58 |     20297 |   12712 | 16961 | 20514 |    2.0031720750401316 |   37.52966395758484
 206 |       59 |     20297 |   12712 | 14734 | 20515 | 0.0023002978546155174 |   39.53283603262497
 207 |       60 |     20297 |   12712 | 14735 | 20512 |  0.004620211162270131 |   39.53513633047959
 208 |       61 |     20297 |   12712 | 14733 | 20518 |   0.31469391309389133 |   39.53975654164186
 209 |       62 |     20297 |   12712 | 14737 | 20517 | 0.0066601968648225115 |   39.85445045473575
 210 |       63 |     20297 |   12712 | 14736 | 20519 |  0.018903908480070467 |   39.86111065160057
 211 |       64 |     20297 |   12712 | 14738 | 20640 |     1.653073770861454 |   39.88001456008064
 212 |       65 |     20297 |   12712 | 14820 | 26468 |    0.9359532628010392 |   41.53308833094209
 213 |       66 |     20297 |   12712 | 19819 | 12983 |    0.5167283502788157 |   42.46904159374313
 214 |       67 |     20297 |   12712 |  8935 |   124 |    1.9083968045578925 |  42.985769944021946
 215 |       68 |     20297 |   12712 |    71 | 26609 |     1.583131917086152 |   44.89416674857984
 216 |       69 |     20297 |   12712 | 19960 | 26500 |     1.291805691229554 |   46.47729866566599
 217 |       70 |     20297 |   12712 | 19851 |   421 |    0.3748799768698678 |   47.76910435689555
 218 |       71 |     20297 |   12712 |   252 | 27605 |    3.3742403272743378 |   48.14398433376542
 219 |       72 |     20297 |   12712 | 20909 |   123 |    1.1593486691102832 |   51.51822466103975
 220 |       73 |     20297 |   12712 |    70 | 17309 |    1.4955334679100953 |   52.67757333015004
 221 |       74 |     20297 |   12712 | 12290 | 26115 |   0.21936536742091248 |   54.17310679806013
 222 |       75 |     20297 |   12712 | 19464 | 22239 |    0.5976036284362439 |  54.392472165481045
 223 |       76 |     20297 |   12712 | 16097 | 13567 |    0.5306644753951875 |   54.99007579391729
 224 |       77 |     20297 |   12712 |  9393 |   495 |    0.8660799751880711 |  55.520740269312476
 225 |       78 |     20297 |   12712 |   295 | 22241 |    0.8373798376215448 |   56.38682024450055
 226 |       79 |     20297 |   12712 | 16099 | 22240 |   0.21240080265253497 |  57.224200082122096
 227 |       80 |     20297 |   12712 | 16098 | 25779 |     1.714828985506206 |   57.43660088477463
 228 |       81 |     20297 |   12712 | 19167 |   491 |   0.05901732549686001 |  59.151429870280836
 229 |       82 |     20297 |   12712 |   293 | 25793 |   0.10568511095728741 |    59.2104471957777
 230 |       83 |     20297 |   12712 | 19175 | 25794 |   0.08844297326700716 |  59.316132306734985
 231 |       84 |     20297 |   12712 | 11774 | 16650 |   0.22524639895077334 |   59.40457528000199
 232 |       85 |     20297 |   12712 | 11773 | 16649 |   0.04124853186930311 |  59.629821678952766
 233 |       86 |     20297 |   12712 | 11770 | 16634 |   0.06465331141053822 |  59.671070210822066
 234 |       87 |     20297 |   12712 | 11764 | 16636 |   0.17572732911684097 |  59.735723522232604
 235 |       88 |     20297 |   12712 | 11765 | 16643 |   0.12687119298067218 |   59.91145085134944
 236 |       89 |     20297 |   12712 | 11769 | 16632 |     0.643916461479013 |  60.038322044330116
 237 |       90 |     20297 |   12712 | 11763 | 16631 |     0.117962755666463 |   60.68223850580913
 238 |       91 |     20297 |   12712 | 11762 | 16630 |     2.897697296438849 |   60.80020126147559
 239 |       92 |     20297 |   12712 |   438 |   737 |    1.5612712946679566 |   63.69789855791444
 240 |       93 |     20297 |   12712 |   920 |  1544 |    1.5556750526791767 |    65.2591698525824
 241 |       94 |     20297 |   12712 |   439 |  1534 |    1.1333538669006435 |   66.81484490526158
 242 |       95 |     20297 |   12712 |   915 |  1529 |   0.12666931366649345 |   67.94819877216223
 243 |       96 |     20297 |   12712 |   912 | 23602 |   0.49085609666166347 |   68.07486808582873
 244 |       97 |     20297 |   12712 | 17301 |  1532 |    0.5273487291853485 |   68.56572418249038
 245 |       98 |     20297 |   12712 |   914 |  1173 |    1.1531916927760584 |   69.09307291167573
 246 |       99 |     20297 |   12712 |   710 | 23604 |     0.780252827684481 |    70.2462646044518
 247 |      100 |     20297 |   12712 | 17303 | 23605 |   0.35829666784834086 |   71.02651743213627
 248 |      101 |     20297 |   12712 | 17304 | 23606 |    0.4988302912535911 |   71.38481409998461
 249 |      102 |     20297 |   12712 | 17305 | 23607 |   0.15785249870585386 |    71.8836443912382
 250 |      103 |     20297 |   12712 |   934 |  1572 |    0.2588780676696366 |   72.04149688994406
 251 |      104 |     20297 |   12712 |   928 |  1562 |    0.6260524126915938 |    72.3003749576137
 252 |      105 |     20297 |   12712 | 19888 | 26536 |    1.1874677659516517 |   72.92642737030529
 253 |      106 |     20297 |   12712 |   929 |  1564 |    0.8900693606434043 |   74.11389513625694
 254 |      107 |     20297 |   12712 | 15152 | 21109 |   0.05256721493063137 |   75.00396449690035
 255 |      108 |     20297 |   12712 | 15151 | 21106 |      2.02625548309686 |   75.05653171183098
 256 |      109 |     20297 |   12712 |   908 |  1522 |       0.6745418451959 |   77.08278719492785
 257 |      110 |     20297 |   12712 |   907 | 10223 |    0.6106547698405649 |   77.75732904012375
 258 |      111 |     20297 |   12712 |  6870 | 12657 |     0.803456372221048 |   78.36798380996431
 259 |      112 |     20297 |   12712 |  8685 | 27668 |   0.15245781715466927 |   79.17144018218536
 260 |      113 |     20297 |   12712 | 20961 | 31660 |    0.1446698121111374 |   79.32389799934003
 261 |      114 |     20297 |   12712 | 20960 | 21131 |   0.19737210502454586 |   79.46856781145117
 262 |      115 |     20297 |   12712 | 15166 | 23611 |    0.2994933055952417 |   79.66593991647571
 263 |      116 |     20297 |   12712 | 17308 | 21132 |   0.07274531629683242 |   79.96543322207096
 264 |      117 |     20297 |   12712 | 15167 | 21129 |    0.3042227143077509 |   80.03817853836779
 265 |      118 |     20297 |   12712 | 15164 | 21128 |   0.24630604483713806 |   80.34240125267554
 266 |      119 |     20297 |   12712 |  8410 | 17834 |     2.588166696930492 |   80.58870729751268
 267 |      120 |     20297 |   12712 | 12712 |    -1 |                     0 |   83.17687399444317
 268 |        1 |     23872 |    6548 | 23872 | 32201 |   0.06805668206097569 |                   0
 269 |        2 |     23872 |    6548 | 13075 |  3157 |   0.36358807862137893 | 0.06805668206097569
 270 |        3 |     23872 |    6548 |  1959 | 27731 |   0.21104501961292096 | 0.43164476068235463
 271 |        4 |     23872 |    6548 | 21023 | 12148 |    1.5631200018908398 |  0.6426897802952756
 272 |        5 |     23872 |    6548 |  8266 |  1650 |    0.3486342960360121 |  2.2058097821861153
 273 |        6 |     23872 |    6548 |   981 | 12150 |   0.23223478879647236 |  2.5544440782221276
 274 |        7 |     23872 |    6548 |  8268 | 13776 |    0.8542068022962522 |     2.7866788670186
 275 |        8 |     23872 |    6548 |  9563 | 26702 |    0.1410343012004297 |   3.640885669314852
 276 |        9 |     23872 |    6548 | 20053 |  1649 |    0.8961587100922042 |  3.7819199705152817
 277 |       10 |     23872 |    6548 |   980 | 27759 |    1.8210516080092494 |   4.678078680607486
 278 |       11 |     23872 |    6548 | 21058 |  1646 |    0.2491760231624967 |   6.499130288616735
 279 |       12 |     23872 |    6548 |   978 | 18330 |    1.7640470015322234 |   6.748306311779232
 280 |       13 |     23872 |    6548 | 13086 |   194 |   0.30480055546417956 |   8.512353313311456
 281 |       14 |     23872 |    6548 |   115 | 18333 |   0.32674651452742576 |   8.817153868775636
 282 |       15 |     23872 |    6548 | 13088 |  3203 |    1.7942834158716068 |    9.14390038330306
 283 |       16 |     23872 |    6548 |  1987 | 10373 |    1.9199258375997346 |  10.938183799174668
 284 |       17 |     23872 |    6548 |  6969 | 16507 |    0.2303077324825455 |  12.858109636774403
 285 |       18 |     23872 |    6548 | 11677 | 16935 |    0.5656413215656309 |  13.088417369256948
 286 |       19 |     23872 |    6548 | 11991 | 18342 |    0.1483856605116069 |  13.654058690822579
 287 |       20 |     23872 |    6548 | 13096 |  2709 |   0.15651144982786416 |  13.802444351334186
 288 |       21 |     23872 |    6548 |  1668 | 21057 |    0.9604341412273633 |   13.95895580116205
 289 |       22 |     23872 |    6548 | 15117 | 18336 |   0.26410208559147896 |  14.919389942389413
 290 |       23 |     23872 |    6548 | 13091 | 27191 |    1.0227463380083683 |  15.183492027980892
 291 |       24 |     23872 |    6548 | 20539 | 12740 |    0.7757825119236388 |   16.20623836598926
 292 |       25 |     23872 |    6548 |  8746 |   627 |   0.16355741867056425 |    16.9820208779129
 293 |       26 |     23872 |    6548 |   368 | 15143 |     1.125270605856866 |  17.145578296583462
 294 |       27 |     23872 |    6548 | 10665 | 15144 |    0.2914794552838489 |  18.270848902440328
 295 |       28 |     23872 |    6548 | 10666 | 26215 |    0.1871910369585799 |  18.562328357724176
 296 |       29 |     23872 |    6548 | 19564 |  1403 |    0.9732351612779111 |  18.749519394682757
 297 |       30 |     23872 |    6548 |   845 |  3231 |    0.6829720712229579 |   19.72275455596067
 298 |       31 |     23872 |    6548 |  2008 | 27172 |     0.527060557496736 |   20.40572662718363
 299 |       32 |     23872 |    6548 | 20522 | 27174 |    0.5852416555437366 |  20.932787184680365
 300 |       33 |     23872 |    6548 | 20523 | 27175 |   0.25823694823881754 |    21.5180288402241
 301 |       34 |     23872 |    6548 | 20524 | 27179 |   0.09444897246840468 |   21.77626578846292
 302 |       35 |     23872 |    6548 | 20527 | 27178 |    0.1351106844674789 |  21.870714760931325
 303 |       36 |     23872 |    6548 | 20526 | 27177 |   0.17491610566208335 |  22.005825445398802
 304 |       37 |     23872 |    6548 | 20525 | 13654 |    0.7630859366178266 |  22.180741551060887
 305 |       38 |     23872 |    6548 |  9462 | 18921 |    0.3314009657264923 |  22.943827487678714
 306 |       39 |     23872 |    6548 | 13553 | 22261 |    0.6752680796377302 |  23.275228453405205
 307 |       40 |     23872 |    6548 | 16118 |   680 |    0.7006899730088552 |  23.950496533042937
 308 |       41 |     23872 |    6548 |   405 | 11307 |     1.321002279113034 |  24.651186506051793
 309 |       42 |     23872 |    6548 |  7626 | 22264 |    0.4151765086045739 |   25.97218878516483
 310 |       43 |     23872 |    6548 | 16120 | 18915 |   0.15895986339925208 |  26.387365293769403
 311 |       44 |     23872 |    6548 | 13548 |   400 |   0.30978776129466296 |  26.546325157168656
 312 |       45 |     23872 |    6548 |   242 |  8111 |     1.019570307783051 |   26.85611291846332
 313 |       46 |     23872 |    6548 |  5336 | 18920 |     0.737069125803382 |  27.875683226246373
 314 |       47 |     23872 |    6548 | 13552 |   129 |     1.160317563317828 |  28.612752352049757
 315 |       48 |     23872 |    6548 |    73 | 23872 |    1.4999309043502846 |  29.773069915367586
 316 |       49 |     23872 |    6548 | 17545 |   133 |    2.5416720886879456 |  31.273000819717872
 317 |       50 |     23872 |    6548 |    75 |  8069 |    1.3341011720340759 |   33.81467290840582
 318 |       51 |     23872 |    6548 |  5343 | 13553 |    0.5901569955725334 |   35.14877408043989
 319 |       52 |     23872 |    6548 |  9383 | 26190 |    0.9976039429508339 |   35.73893107601243
 320 |       53 |     23872 |    6548 | 19540 | 20372 |    0.3673098782657977 |   36.73653501896326
 321 |       54 |     23872 |    6548 | 14633 |  1209 |    1.3869035592666186 |   37.10384489722906
 322 |       55 |     23872 |    6548 |   730 |  8118 |    0.5480203595774447 |   38.49074845649568
 323 |       56 |     23872 |    6548 |  5340 |  8120 |   0.24661536332537454 |   39.03876881607312
 324 |       57 |     23872 |    6548 |  5341 |  1407 |    0.9011935849719097 |    39.2853841793985
 325 |       58 |     23872 |    6548 |   847 | 23627 |     0.851447391657154 |  40.186577764370405
 326 |       59 |     23872 |    6548 | 17326 |  1201 |    1.0407105655184872 |   41.03802515602756
 327 |       60 |     23872 |    6548 |   725 |  1593 |    0.7549616786772835 |  42.078735721546046
 328 |       61 |     23872 |    6548 |   945 |  1188 |    0.8973447981353181 |   42.83369740022333
 329 |       62 |     23872 |    6548 |   719 |  1546 |    1.6264734573443969 |  43.731042198358644
 330 |       63 |     23872 |    6548 |   921 |  1185 |    1.6991371093296281 |   45.35751565570304
 331 |       64 |     23872 |    6548 |   718 |  1184 |    1.8421736843279646 |  47.056652765032666
 332 |       65 |     23872 |    6548 |   717 |  1183 |    0.1756919131137854 |  48.898826449360634
 333 |       66 |     23872 |    6548 |   716 | 23660 |    1.8123985785207926 |   49.07451836247442
 334 |       67 |     23872 |    6548 | 17357 | 23659 |   0.36273817018997895 |  50.886916940995214
 335 |       68 |     23872 |    6548 | 17356 |  1167 |     0.626156991097495 |   51.24965511118519
 336 |       69 |     23872 |    6548 |   707 | 27647 |    0.8387670351127208 |   51.87581210228269
 337 |       70 |     23872 |    6548 | 20941 | 16702 |   0.12894862835814783 |   52.71457913739541
 338 |       71 |     23872 |    6548 | 11812 | 11567 |   0.07991115929950714 |   52.84352776575356
 339 |       72 |     23872 |    6548 |  7833 | 11568 |   0.11326487361311087 |   52.92343892505306
 340 |       73 |     23872 |    6548 | 20452 | 30815 |   0.07535350641778579 |  53.036703798666174
 341 |       74 |     23872 |    6548 | 23098 | 28767 |   0.03309675319578663 |   53.11205730508396
 342 |       75 |     23872 |    6548 | 20469 | 27118 |  0.034552563959477936 |   53.14515405827974
 343 |       76 |     23872 |    6548 | 11871 | 16777 |    0.6255872238261259 |   53.17970662223922
 344 |       77 |     23872 |    6548 | 11892 | 16806 |    0.2733802945271186 |   53.80529384606535
 345 |       78 |     23872 |    6548 | 11878 | 16787 |    0.4535501572085256 |   54.07867414059246
 346 |       79 |     23872 |    6548 | 11869 | 16774 |   0.45506457703859515 |   54.53222429780099
 347 |       80 |     23872 |    6548 | 11830 | 28338 |   0.08132055779621455 |  54.987288874839585
 348 |       81 |     23872 |    6548 | 20449 | 27098 |    1.0914902315936266 |    55.0686094326358
 349 |       82 |     23872 |    6548 | 20436 | 27085 |   0.12495355233873824 |   56.16009966422943
 350 |       83 |     23872 |    6548 | 20435 | 27084 |   0.39528598989016855 |  56.285053216568166
 351 |       84 |     23872 |    6548 |  7838 |  1427 |    0.7519036848438131 |  56.680339206458335
 352 |       85 |     23872 |    6548 |   859 |  1487 |    0.7539750610187245 |  57.432242891302145
 353 |       86 |     23872 |    6548 |   890 |  1462 |    0.8494955049274071 |   58.18621795232087
 354 |       87 |     23872 |    6548 |   877 |  1424 |     0.646278635169287 |   59.03571345724827
 355 |       88 |     23872 |    6548 |   858 |  1433 |    0.9807808613798237 |   59.68199209241756
 356 |       89 |     23872 |    6548 |   862 |  1423 |    1.0199212715442947 |  60.662772953797386
 357 |       90 |     23872 |    6548 |   857 |  1437 |    0.7161152936403937 |   61.68269422534168
 358 |       91 |     23872 |    6548 |   864 | 27599 |    0.5665047170246813 |   62.39880951898207
 359 |       92 |     23872 |    6548 | 20904 | 11619 |    0.3783867251755075 |   62.96531423600675
 360 |       93 |     23872 |    6548 |  7870 | 27666 |    0.9365782010150971 |   63.34370096118226
 361 |       94 |     23872 |    6548 | 20959 | 27578 |   0.44210112194571666 |   64.28027916219736
 362 |       95 |     23872 |    6548 | 20889 | 18459 |    0.5733077932740185 |   64.72238028414307
 363 |       96 |     23872 |    6548 | 13183 | 27579 |   0.38189432739516077 |   65.29568807741708
 364 |       97 |     23872 |    6548 | 20890 |  1495 |     1.136793958893462 |   65.67758240481224
 365 |       98 |     23872 |    6548 |   894 | 17826 |    1.1112008432217284 |    66.8143763637057
 366 |       99 |     23872 |    6548 | 12704 |  1493 |   0.07367876951749965 |   67.92557720692743
 367 |      100 |     23872 |    6548 |   893 |  1492 |    1.4031344334215368 |   67.99925597644493
 368 |      101 |     23872 |    6548 |  6851 | 10192 |    1.5701364203847021 |   69.40239040986647
 369 |      102 |     23872 |    6548 |  6853 | 10196 |   0.28953913067174697 |   70.97252683025117
 370 |      103 |     23872 |    6548 |  7228 | 27023 |   0.19879925415989355 |   71.26206596092291
 371 |      104 |     23872 |    6548 | 20376 | 27051 |    0.6494372977886846 |    71.4608652150828
 372 |      105 |     23872 |    6548 | 20403 | 19755 |    0.2275298400422538 |   72.11030251287148
 373 |      106 |     23872 |    6548 | 14206 | 19711 |    0.9220587215680605 |   72.33783235291374
 374 |      107 |     23872 |    6548 | 14174 | 17832 |   0.21640993474988235 |    73.2598910744818
 375 |      108 |     23872 |    6548 | 12710 | 19741 |    0.3201268812552062 |   73.47630100923168
 376 |      109 |     23872 |    6548 | 14195 | 19743 |   0.49508260952955185 |   73.79642789048688
 377 |      110 |     23872 |    6548 | 14196 | 19744 |   0.48439496686567235 |   74.29151050001643
 378 |      111 |     23872 |    6548 | 14197 | 19745 |    0.4169018723910478 |   74.77590546688211
 379 |      112 |     23872 |    6548 | 14198 |  9813 |    0.1808437523641115 |   75.19280733927316
 380 |      113 |     23872 |    6548 |  6562 | 15879 |   0.02937298113632556 |   75.37365109163727
 381 |      114 |     23872 |    6548 | 11211 |  9805 |   0.21298179959991656 |   75.40302407277359
 382 |      115 |     23872 |    6548 |  6558 |  9800 |     0.521207020386025 |    75.6160058723735
 383 |      116 |     23872 |    6548 |  6555 | 27063 |  0.026989071884391005 |   76.13721289275954
 384 |      117 |     23872 |    6548 | 20413 |  9792 |   0.09676253961561734 |   76.16420196464392
 385 |      118 |     23872 |    6548 |  6548 |    -1 |                     0 |   76.26096450425953
 386 |        1 |     23872 |   12712 | 23872 | 32201 |   0.06805668206097569 |                   0
 387 |        2 |     23872 |   12712 | 13075 |  3157 |   0.36358807862137893 | 0.06805668206097569
 388 |        3 |     23872 |   12712 |  1959 | 27731 |   0.21104501961292096 | 0.43164476068235463
 389 |        4 |     23872 |   12712 | 21023 | 12148 |    1.5631200018908398 |  0.6426897802952756
 390 |        5 |     23872 |   12712 |  8266 |  1650 |    0.3486342960360121 |  2.2058097821861153
 391 |        6 |     23872 |   12712 |   981 | 12150 |   0.23223478879647236 |  2.5544440782221276
 392 |        7 |     23872 |   12712 |  8268 | 13776 |    0.8542068022962522 |     2.7866788670186
 393 |        8 |     23872 |   12712 |  9563 | 26702 |    0.1410343012004297 |   3.640885669314852
 394 |        9 |     23872 |   12712 | 20053 |  1649 |    0.8961587100922042 |  3.7819199705152817
 395 |       10 |     23872 |   12712 |   980 | 27759 |    1.8210516080092494 |   4.678078680607486
 396 |       11 |     23872 |   12712 | 21058 |  1646 |    0.2491760231624967 |   6.499130288616735
 397 |       12 |     23872 |   12712 |   978 | 18330 |    1.7640470015322234 |   6.748306311779232
 398 |       13 |     23872 |   12712 | 13086 |   194 |   0.30480055546417956 |   8.512353313311456
 399 |       14 |     23872 |   12712 |   115 | 18333 |   0.32674651452742576 |   8.817153868775636
 400 |       15 |     23872 |   12712 | 13088 |  3203 |    1.7942834158716068 |    9.14390038330306
 401 |       16 |     23872 |   12712 |  1987 | 10373 |    1.9199258375997346 |  10.938183799174668
 402 |       17 |     23872 |   12712 |  6969 | 16507 |    0.2303077324825455 |  12.858109636774403
 403 |       18 |     23872 |   12712 | 11677 | 16935 |    0.5656413215656309 |  13.088417369256948
 404 |       19 |     23872 |   12712 | 11991 | 18342 |    0.1483856605116069 |  13.654058690822579
 405 |       20 |     23872 |   12712 | 13096 |  2709 |   0.15651144982786416 |  13.802444351334186
 406 |       21 |     23872 |   12712 |  1668 | 21057 |    0.9604341412273633 |   13.95895580116205
 407 |       22 |     23872 |   12712 | 15117 | 18336 |   0.26410208559147896 |  14.919389942389413
 408 |       23 |     23872 |   12712 | 13091 | 27191 |    1.0227463380083683 |  15.183492027980892
 409 |       24 |     23872 |   12712 | 20539 | 12740 |    0.7757825119236388 |   16.20623836598926
 410 |       25 |     23872 |   12712 |  8746 |   627 |   0.16355741867056425 |    16.9820208779129
 411 |       26 |     23872 |   12712 |   368 | 15143 |     1.125270605856866 |  17.145578296583462
 412 |       27 |     23872 |   12712 | 10665 | 15144 |    0.2914794552838489 |  18.270848902440328
 413 |       28 |     23872 |   12712 | 10666 | 26215 |    0.1871910369585799 |  18.562328357724176
 414 |       29 |     23872 |   12712 | 19564 |  1403 |    0.9732351612779111 |  18.749519394682757
 415 |       30 |     23872 |   12712 |   845 |  3231 |    0.6829720712229579 |   19.72275455596067
 416 |       31 |     23872 |   12712 |  2008 | 27172 |     0.527060557496736 |   20.40572662718363
 417 |       32 |     23872 |   12712 | 20522 | 27174 |    0.5852416555437366 |  20.932787184680365
 418 |       33 |     23872 |   12712 | 20523 | 27175 |   0.25823694823881754 |    21.5180288402241
 419 |       34 |     23872 |   12712 | 20524 | 27179 |   0.09444897246840468 |   21.77626578846292
 420 |       35 |     23872 |   12712 | 20527 | 27178 |    0.1351106844674789 |  21.870714760931325
 421 |       36 |     23872 |   12712 | 20526 | 27177 |   0.17491610566208335 |  22.005825445398802
 422 |       37 |     23872 |   12712 | 20525 | 13654 |    0.7630859366178266 |  22.180741551060887
 423 |       38 |     23872 |   12712 |  9462 | 18921 |    0.3314009657264923 |  22.943827487678714
 424 |       39 |     23872 |   12712 | 13553 | 22261 |    0.6752680796377302 |  23.275228453405205
 425 |       40 |     23872 |   12712 | 16118 |   680 |    0.7006899730088552 |  23.950496533042937
 426 |       41 |     23872 |   12712 |   405 | 11307 |     1.321002279113034 |  24.651186506051793
 427 |       42 |     23872 |   12712 |  7626 | 22264 |    0.4151765086045739 |   25.97218878516483
 428 |       43 |     23872 |   12712 | 16120 | 18915 |   0.15895986339925208 |  26.387365293769403
 429 |       44 |     23872 |   12712 | 13548 |   400 |   0.30978776129466296 |  26.546325157168656
 430 |       45 |     23872 |   12712 |   242 |  8111 |     1.019570307783051 |   26.85611291846332
 431 |       46 |     23872 |   12712 |  5336 | 18920 |     0.737069125803382 |  27.875683226246373
 432 |       47 |     23872 |   12712 | 13552 |   129 |     1.160317563317828 |  28.612752352049757
 433 |       48 |     23872 |   12712 |    73 | 23872 |    1.4999309043502846 |  29.773069915367586
 434 |       49 |     23872 |   12712 | 17545 |   133 |    2.5416720886879456 |  31.273000819717872
 435 |       50 |     23872 |   12712 |    75 |  8069 |    1.3341011720340759 |   33.81467290840582
 436 |       51 |     23872 |   12712 |  5343 | 13553 |    0.5901569955725334 |   35.14877408043989
 437 |       52 |     23872 |   12712 |  9383 | 26190 |    0.9976039429508339 |   35.73893107601243
 438 |       53 |     23872 |   12712 | 19540 | 20372 |    0.3673098782657977 |   36.73653501896326
 439 |       54 |     23872 |   12712 | 14633 |  1209 |    1.3869035592666186 |   37.10384489722906
 440 |       55 |     23872 |   12712 |   730 |  8118 |    0.5480203595774447 |   38.49074845649568
 441 |       56 |     23872 |   12712 |  5340 |  8120 |   0.24661536332537454 |   39.03876881607312
 442 |       57 |     23872 |   12712 |  5341 |  1407 |    0.9011935849719097 |    39.2853841793985
 443 |       58 |     23872 |   12712 |   847 | 23627 |     0.851447391657154 |  40.186577764370405
 444 |       59 |     23872 |   12712 | 17326 |  1201 |    1.0407105655184872 |   41.03802515602756
 445 |       60 |     23872 |   12712 |   725 |  1593 |    0.7549616786772835 |  42.078735721546046
 446 |       61 |     23872 |   12712 |   945 |  1188 |    0.8973447981353181 |   42.83369740022333
 447 |       62 |     23872 |   12712 |   719 |  1546 |    1.6264734573443969 |  43.731042198358644
 448 |       63 |     23872 |   12712 |   921 |  1185 |    1.6991371093296281 |   45.35751565570304
 449 |       64 |     23872 |   12712 |   718 |  1184 |    1.8421736843279646 |  47.056652765032666
 450 |       65 |     23872 |   12712 |   717 |  1183 |    0.1756919131137854 |  48.898826449360634
 451 |       66 |     23872 |   12712 |   716 | 23660 |    1.8123985785207926 |   49.07451836247442
 452 |       67 |     23872 |   12712 | 17357 | 23659 |   0.36273817018997895 |  50.886916940995214
 453 |       68 |     23872 |   12712 | 17356 |  1167 |     0.626156991097495 |   51.24965511118519
 454 |       69 |     23872 |   12712 |   707 | 27647 |    0.8387670351127208 |   51.87581210228269
 455 |       70 |     23872 |   12712 | 20941 | 16702 |   0.12894862835814783 |   52.71457913739541
 456 |       71 |     23872 |   12712 | 11812 | 11567 |   0.07991115929950714 |   52.84352776575356
 457 |       72 |     23872 |   12712 |  7833 | 11569 |    1.0024513512787812 |   52.92343892505306
 458 |       73 |     23872 |   12712 |  7834 | 27106 |   0.09733636113547829 |   53.92589027633184
 459 |       74 |     23872 |   12712 | 20457 | 27105 |   0.11538771350389099 |   54.02322663746732
 460 |       75 |     23872 |   12712 | 20456 | 28791 |   0.04677187008474406 |   54.13861435097121
 461 |       76 |     23872 |   12712 | 23137 | 30882 |   0.03792144529170564 |   54.18538622105596
 462 |       77 |     23872 |   12712 | 23067 | 30752 |   0.01528834893135846 |  54.223307666347665
 463 |       78 |     23872 |   12712 | 23136 | 30880 |   0.25934575584305203 |   54.23859601527902
 464 |       79 |     23872 |   12712 | 23132 | 30859 |    0.6112590697292155 |   54.49794177112207
 465 |       80 |     23872 |   12712 | 23125 | 28782 |  0.024489716732977097 |   55.10920084085129
 466 |       81 |     23872 |   12712 | 20502 | 30861 |    0.0258239878525215 |  55.133690557584266
 467 |       82 |     23872 |   12712 | 23126 | 30851 |   0.10226185353781583 |  55.159514545436785
 468 |       83 |     23872 |   12712 | 23120 | 30839 |    0.2107442226358855 |  55.261776398974604
 469 |       84 |     23872 |   12712 | 23114 | 30841 |    0.2148926523942987 |   55.47252062161049
 470 |       85 |     23872 |   12712 | 23115 | 28774 |  0.028254750132349193 |   55.68741327400479
 471 |       86 |     23872 |   12712 | 20498 | 30868 |    0.0309845027976242 |   55.71566802413714
 472 |       87 |     23872 |   12712 | 23130 | 30845 |    0.3343040635083571 |   55.74665252693476
 473 |       88 |     23872 |   12712 | 23117 | 30846 |   0.04791976997230444 |  56.080956590443115
 474 |       89 |     23872 |   12712 | 23118 | 30886 |  0.033789572101410564 |   56.12887636041542
 475 |       90 |     23872 |   12712 | 23139 | 28792 |   0.10716538466016473 |   56.16266593251683
 476 |       91 |     23872 |   12712 | 20495 | 18537 |  0.008849574550625895 |  56.269831317176994
 477 |       92 |     23872 |   12712 | 13243 | 18536 |    0.8153302914795523 |   56.27868089172762
 478 |       93 |     23872 |   12712 |   901 |  1508 |     0.628403335656021 |   57.09401118320717
 479 |       94 |     23872 |   12712 |   904 |  1515 |    1.0419783628717416 |    57.7224145188632
 480 |       95 |     23872 |   12712 |   712 |  1176 |    0.7730201625706823 |  58.764392881734935
 481 |       96 |     23872 |   12712 |  8328 | 12226 |   0.17910962720385096 |  59.537413044305616
 482 |       97 |     23872 |   12712 |  8329 |  1520 |    1.3883761676173587 |  59.716522671509466
 483 |       98 |     23872 |   12712 |   906 |  1523 |    0.5576579571323116 |  61.104898839126825
 484 |       99 |     23872 |   12712 |   908 |  1522 |       0.6745418451959 |   61.66255679625914
 485 |      100 |     23872 |   12712 |   907 | 10223 |    0.6106547698405649 |  62.337098641455036
 486 |      101 |     23872 |   12712 |  6870 | 12657 |     0.803456372221048 |    62.9477534112956
 487 |      102 |     23872 |   12712 |  8685 | 27668 |   0.15245781715466927 |   63.75120978351665
 488 |      103 |     23872 |   12712 | 20961 | 31660 |    0.1446698121111374 |   63.90366760067132
 489 |      104 |     23872 |   12712 | 20960 | 21131 |   0.19737210502454586 |   64.04833741278246
 490 |      105 |     23872 |   12712 | 15166 | 23611 |    0.2994933055952417 |     64.245709517807
 491 |      106 |     23872 |   12712 | 17308 | 21132 |   0.07274531629683242 |   64.54520282340225
 492 |      107 |     23872 |   12712 | 15167 | 21129 |    0.3042227143077509 |   64.61794813969908
 493 |      108 |     23872 |   12712 | 15164 | 21128 |   0.24630604483713806 |   64.92217085400684
 494 |      109 |     23872 |   12712 |  8410 | 17834 |     2.588166696930492 |   65.16847689884398
 495 |      110 |     23872 |   12712 | 12712 |    -1 |                     0 |   67.75664359577446
(495 rows)

Note

Inspecting the results, looking for totals (edge = -1):

  • From 20297 to vertex 6548 takes 92.58 minutes (seq = 147)

  • From 20297 to vertex 12712 takes 83.18 minutes (seq = 267)

  • From 23872 to vertex 6548 takes 76.26 minutes (seq = 385)

  • From 23872 to vertex 12712 takes 67.76 minutes (seq = 495)

2.1.5. Exercise 5: Combination of routes

Problem:

  • Walking

    • First pedestrian goes from “Hangar Convention Center” to “Forte do Castelo”

    • Second pedestrian goes from “Instituto Federal do Pará, Campus Belém” to “Estação das Docas”

  • Calculate routes with costs in minutes.

../_images/pedestrian_combinations.png

Solution:

  • First pedestrian departs from 20297 and the destination is 6548 (line 11).

  • Second pedestrian departs from 23872 and the destination is 12712 (line 12).

  • The cost to be in minutes, with a walking speed s = 1.3 m/s and t = d/s

SELECT * FROM pgr_dijkstra(
  '
    SELECT gid AS id,
      source,
      target,
      length_m / 1.3 / 60 AS cost
    FROM ways
  ',
  'SELECT * FROM
    (VALUES
      (20297, 6548), -- line 11
      (23872, 12712)) -- line 12
    AS combinations (source, target)',
  directed := false);
 seq | path_seq | start_vid | end_vid | node  | edge  |         cost          |      agg_cost       
-----+----------+-----------+---------+-------+-------+-----------------------+---------------------
   1 |        1 |     20297 |    6548 | 20297 | 31885 |    0.2442208146685645 |                   0
   2 |        2 |     20297 |    6548 | 20296 |    91 |   0.16396488105467422 |  0.2442208146685645
   3 |        3 |     20297 |    6548 |    54 | 10915 |    0.5072706107896474 |  0.4081856957232387
   4 |        4 |     20297 |    6548 |  7354 |  1743 |      2.03440763773679 |  0.9154563065128861
   5 |        5 |     20297 |    6548 |  1033 |  1775 |     2.151076327811315 |   2.949863944249676
   6 |        6 |     20297 |    6548 |  1051 | 10920 |    1.3195528137165378 |   5.100940272060991
   7 |        7 |     20297 |    6548 |  7357 |  1835 |     0.874244991136652 |   6.420493085777529
   8 |        8 |     20297 |    6548 |  1084 | 10927 |    1.2797656853302073 |  7.2947380769141805
   9 |        9 |     20297 |    6548 |  7361 |  1725 |     0.789871887731233 |   8.574503762244388
  10 |       10 |     20297 |    6548 |  1022 | 10346 |     1.785044329818824 |    9.36437564997562
  11 |       11 |     20297 |    6548 |  6953 | 27847 |   0.21510977352863703 |  11.149419979794445
  12 |       12 |     20297 |    6548 | 21151 |   540 |    0.1511669884113203 |  11.364529753323081
  13 |       13 |     20297 |    6548 |   320 | 27845 |   0.14276916543781187 |  11.515696741734402
  14 |       14 |     20297 |    6548 | 21149 | 10350 |    0.2454315054856474 |  11.658465907172214
  15 |       15 |     20297 |    6548 |  6955 |   565 |    1.7236943638842155 |  11.903897412657862
  16 |       16 |     20297 |    6548 |   333 | 15283 |    0.7071674037549599 |  13.627591776542078
  17 |       17 |     20297 |    6548 | 10784 | 10752 |    1.2036471274472935 |  14.334759180297038
  18 |       18 |     20297 |    6548 |  7234 | 10409 |   0.13654813331711801 |  15.538406307744332
  19 |       19 |     20297 |    6548 |  6990 | 10411 |   0.10649334393058388 |   15.67495444106145
  20 |       20 |     20297 |    6548 |  6991 | 15288 |    1.7305785509357259 |  15.781447784992034
  21 |       21 |     20297 |    6548 | 10787 |   375 |   0.35236431869770474 |   17.51202633592776
  22 |       22 |     20297 |    6548 |   226 | 15295 |    0.3037754769217017 |  17.864390654625467
  23 |       23 |     20297 |    6548 | 10791 | 13798 |    0.5922589521877473 |  18.168166131547167
  24 |       24 |     20297 |    6548 |  9580 | 27297 |    0.6848875471163183 |  18.760425083734916
  25 |       25 |     20297 |    6548 | 20647 |  3285 |    0.5377412092676153 |  19.445312630851234
  26 |       26 |     20297 |    6548 |  2040 | 15304 |    0.1440286141822674 |   19.98305384011885
  27 |       27 |     20297 |    6548 | 10796 | 13799 |    0.9804990331552915 |  20.127082454301117
  28 |       28 |     20297 |    6548 |  9581 | 10935 |    0.0872347265307853 |  21.107581487456407
  29 |       29 |     20297 |    6548 |  7366 |  3256 |    0.9160356651543197 |  21.194816213987192
  30 |       30 |     20297 |    6548 |  2023 | 15305 |   0.27735562607385766 |   22.11085187914151
  31 |       31 |     20297 |    6548 | 10797 | 18878 |    0.5873037577521025 |   22.38820750521537
  32 |       32 |     20297 |    6548 | 13516 | 18875 |    0.5339697579019742 |  22.975511262967473
  33 |       33 |     20297 |    6548 | 13514 | 18321 |    0.5540940298706025 |  23.509481020869448
  34 |       34 |     20297 |    6548 | 13078 |  3255 |   0.12117931351154926 |   24.06357505074005
  35 |       35 |     20297 |    6548 |  2022 | 18324 |   0.16404112520048286 |    24.1847543642516
  36 |       36 |     20297 |    6548 | 13081 | 18872 |    1.1531336016079632 |  24.348795489452083
  37 |       37 |     20297 |    6548 | 13512 | 12139 |    0.4403589342516953 |  25.501929091060045
  38 |       38 |     20297 |    6548 |  8261 | 15310 |   0.22073066226788918 |   25.94228802531174
  39 |       39 |     20297 |    6548 | 10800 |  1655 |   0.12947747243674088 |   26.16301868757963
  40 |       40 |     20297 |    6548 |   983 | 12144 |   0.17872711075476105 |   26.29249616001637
  41 |       41 |     20297 |    6548 |  8264 | 15317 |   0.23741482839670042 |   26.47122327077113
  42 |       42 |     20297 |    6548 | 10804 |  1657 |     1.713537948521927 |  26.708638099167832
  43 |       43 |     20297 |    6548 |   985 | 10077 |    1.0311642333444058 |   28.42217604768976
  44 |       44 |     20297 |    6548 |  6769 | 10359 |    0.1421078139062752 |  29.453340281034166
  45 |       45 |     20297 |    6548 |  6960 |  7947 |    0.3502978373404711 |   29.59544809494044
  46 |       46 |     20297 |    6548 |  5227 |   508 |    0.5604942573669909 |   29.94574593228091
  47 |       47 |     20297 |    6548 |   302 | 23247 |    1.3080488355819773 |    30.5062401896479
  48 |       48 |     20297 |    6548 | 16963 |  1628 |   0.20867781011403078 |   31.81428902522988
  49 |       49 |     20297 |    6548 |   966 |  1636 |    0.4348900983316335 |   32.02296683534391
  50 |       50 |     20297 |    6548 |   971 |   148 |    1.2097121065487053 |  32.457856933675544
  51 |       51 |     20297 |    6548 |    83 | 23450 |    1.2683854997554649 |   33.66756904022425
  52 |       52 |     20297 |    6548 | 17152 |   320 |  0.004139926882906371 |   34.93595453997972
  53 |       53 |     20297 |    6548 |   197 | 24810 |    0.7105542239267345 |  34.940094466862625
  54 |       54 |     20297 |    6548 | 18350 | 20586 |   0.13057016468240487 |   35.65064869078936
  55 |       55 |     20297 |    6548 | 14785 | 20587 |   0.03766657553494008 |  35.781218855471764
  56 |       56 |     20297 |    6548 | 14786 | 20524 |   0.38813765244320864 |  35.818885431006706
  57 |       57 |     20297 |    6548 | 14741 | 23244 |     1.322640874134927 |   36.20702308344991
  58 |       58 |     20297 |    6548 | 16961 | 20514 |    2.0031720750401316 |   37.52966395758484
  59 |       59 |     20297 |    6548 | 14734 | 20515 | 0.0023002978546155174 |   39.53283603262497
  60 |       60 |     20297 |    6548 | 14735 | 20512 |  0.004620211162270131 |   39.53513633047959
  61 |       61 |     20297 |    6548 | 14733 | 20518 |   0.31469391309389133 |   39.53975654164186
  62 |       62 |     20297 |    6548 | 14737 | 20517 | 0.0066601968648225115 |   39.85445045473575
  63 |       63 |     20297 |    6548 | 14736 | 20519 |  0.018903908480070467 |   39.86111065160057
  64 |       64 |     20297 |    6548 | 14738 | 20640 |     1.653073770861454 |   39.88001456008064
  65 |       65 |     20297 |    6548 | 14820 | 26468 |    0.9359532628010392 |   41.53308833094209
  66 |       66 |     20297 |    6548 | 19819 | 12983 |    0.5167283502788157 |   42.46904159374313
  67 |       67 |     20297 |    6548 |  8935 |   124 |    1.9083968045578925 |  42.985769944021946
  68 |       68 |     20297 |    6548 |    71 | 26609 |     1.583131917086152 |   44.89416674857984
  69 |       69 |     20297 |    6548 | 19960 | 26500 |     1.291805691229554 |   46.47729866566599
  70 |       70 |     20297 |    6548 | 19851 |   421 |    0.3748799768698678 |   47.76910435689555
  71 |       71 |     20297 |    6548 |   252 | 27605 |    3.3742403272743378 |   48.14398433376542
  72 |       72 |     20297 |    6548 | 20909 |   123 |    1.1593486691102832 |   51.51822466103975
  73 |       73 |     20297 |    6548 |    70 | 17309 |    1.4955334679100953 |   52.67757333015004
  74 |       74 |     20297 |    6548 | 12290 | 26115 |   0.21936536742091248 |   54.17310679806013
  75 |       75 |     20297 |    6548 | 19464 | 22239 |    0.5976036284362439 |  54.392472165481045
  76 |       76 |     20297 |    6548 | 16097 | 13567 |    0.5306644753951875 |   54.99007579391729
  77 |       77 |     20297 |    6548 |  9393 |   495 |    0.8660799751880711 |  55.520740269312476
  78 |       78 |     20297 |    6548 |   295 | 22241 |    0.8373798376215448 |   56.38682024450055
  79 |       79 |     20297 |    6548 | 16099 | 22240 |   0.21240080265253497 |  57.224200082122096
  80 |       80 |     20297 |    6548 | 16098 | 25779 |     1.714828985506206 |   57.43660088477463
  81 |       81 |     20297 |    6548 | 19167 |   491 |   0.05901732549686001 |  59.151429870280836
  82 |       82 |     20297 |    6548 |   293 | 25793 |   0.10568511095728741 |    59.2104471957777
  83 |       83 |     20297 |    6548 | 19175 | 25730 |  0.014484151152383405 |  59.316132306734985
  84 |       84 |     20297 |    6548 | 19132 | 25731 |    0.1731887873430192 |  59.330616457887366
  85 |       85 |     20297 |    6548 | 19133 | 25792 |   0.04399689702387814 |   59.50380524523039
  86 |       86 |     20297 |    6548 | 19174 |  1150 |   0.05933636846802722 |   59.54780214225427
  87 |       87 |     20297 |    6548 |   698 | 11107 |   0.17374282311946126 |  59.607138510722294
  88 |       88 |     20297 |    6548 |  7481 | 16637 |    0.1857603022223164 |  59.780881333841755
  89 |       89 |     20297 |    6548 | 11766 | 21359 |    1.7430878754564423 |   59.96664163606407
  90 |       90 |     20297 |    6548 | 15367 | 15072 |    1.0925842217158432 |   61.70972951152051
  91 |       91 |     20297 |    6548 | 10611 |  1170 |    1.5690635162987887 |   62.80231373323635
  92 |       92 |     20297 |    6548 |   709 |  1168 |    1.5570199847118493 |   64.37137724953514
  93 |       93 |     20297 |    6548 |   708 |  1161 |    3.1706330870317943 |   65.92839723424699
  94 |       94 |     20297 |    6548 |   705 | 21116 |    1.2315680166184089 |   69.09903032127878
  95 |       95 |     20297 |    6548 | 15156 | 21118 |    0.0332524363091896 |   70.33059833789719
  96 |       96 |     20297 |    6548 | 15157 | 21119 |  0.017129604719012113 |   70.36385077420637
  97 |       97 |     20297 |    6548 | 20505 | 27154 |  0.027105494272354376 |   70.38098037892539
  98 |       98 |     20297 |    6548 | 11807 | 16736 |   0.09150495785271036 |   70.40808587319773
  99 |       99 |     20297 |    6548 | 11838 | 16735 |   0.23862498070176494 |   70.49959083105044
 100 |      100 |     20297 |    6548 | 11836 | 16733 |    0.2081188811279414 |   70.73821581175221
 101 |      101 |     20297 |    6548 | 11831 | 16727 |    0.4216864040282573 |   70.94633469288016
 102 |      102 |     20297 |    6548 | 20498 | 27147 |   0.02933617597188901 |   71.36802109690842
 103 |      103 |     20297 |    6548 | 11815 | 16707 |  0.027916135868862536 |   71.39735727288031
 104 |      104 |     20297 |    6548 | 20500 | 27149 |   0.31674103134200915 |   71.42527340874918
 105 |      105 |     20297 |    6548 | 11814 | 16705 |   0.13309805893880447 |   71.74201444009118
 106 |      106 |     20297 |    6548 | 11222 | 15890 |     0.312047910869037 |   71.87511249902998
 107 |      107 |     20297 |    6548 | 11219 | 16741 |    0.1929892180658986 |   72.18716040989902
 108 |      108 |     20297 |    6548 | 11844 | 27162 |    0.3735261999253613 |   72.38014962796493
 109 |      109 |     20297 |    6548 | 20513 | 28355 |    0.1862882866502802 |   72.75367582789029
 110 |      110 |     20297 |    6548 | 20514 | 28356 |    0.2100380064430438 |   72.93996411454057
 111 |      111 |     20297 |    6548 | 20515 | 16768 |   0.12412875211514746 |   73.15000212098361
 112 |      112 |     20297 |    6548 | 11864 | 31923 |   0.05522082894237899 |   73.27413087309876
 113 |      113 |     20297 |    6548 | 23006 | 31859 |    0.2041036869863129 |   73.32935170204114
 114 |      114 |     20297 |    6548 | 11877 | 31860 |   0.08763596168887573 |   73.53345538902745
 115 |      115 |     20297 |    6548 | 20448 | 27097 |   0.08367222126577643 |   73.62109135071633
 116 |      116 |     20297 |    6548 | 11862 | 10184 |   0.14722268073091993 |    73.7047635719821
 117 |      117 |     20297 |    6548 |  6847 |  1481 |    0.6383275468683184 |   73.85198625271302
 118 |      118 |     20297 |    6548 |   886 |  1442 |    1.4571273828152245 |   74.49031379958134
 119 |      119 |     20297 |    6548 |   867 |  1440 |    0.8210564579154069 |   75.94744118239657
 120 |      120 |     20297 |    6548 |   866 |  1420 |     1.039363969681231 |   76.76849764031198
 121 |      121 |     20297 |    6548 |   855 |  1418 |    0.9730075482588322 |   77.80786160999321
 122 |      122 |     20297 |    6548 |   854 | 25659 |    0.4015272779257525 |   78.78086915825205
 123 |      123 |     20297 |    6548 | 19077 |  1414 |    0.9281911182398142 |    79.1823964361778
 124 |      124 |     20297 |    6548 |   852 | 18518 |    1.0630019360185363 |    80.1105875544176
 125 |      125 |     20297 |    6548 | 13229 | 18519 |    0.9552289666901567 |   81.17358949043614
 126 |      126 |     20297 |    6548 | 13227 | 18515 |    1.1559405960346478 |    82.1288184571263
 127 |      127 |     20297 |    6548 | 12703 | 17825 |   0.03555036611124576 |   83.28475905316095
 128 |      128 |     20297 |    6548 |  7261 | 10798 |    0.9975859632821131 |    83.3203094192722
 129 |      129 |     20297 |    6548 |   893 |  1492 |    1.4031344334215368 |   84.31789538255433
 130 |      130 |     20297 |    6548 |  6851 | 10192 |    1.5701364203847021 |   85.72102981597587
 131 |      131 |     20297 |    6548 |  6853 | 10196 |   0.28953913067174697 |   87.29116623636057
 132 |      132 |     20297 |    6548 |  7228 | 27023 |   0.19879925415989355 |   87.58070536703231
 133 |      133 |     20297 |    6548 | 20376 | 27051 |    0.6494372977886846 |    87.7795046211922
 134 |      134 |     20297 |    6548 | 20403 | 19755 |    0.2275298400422538 |   88.42894191898088
 135 |      135 |     20297 |    6548 | 14206 | 19711 |    0.9220587215680605 |   88.65647175902313
 136 |      136 |     20297 |    6548 | 14174 | 17832 |   0.21640993474988235 |    89.5785304805912
 137 |      137 |     20297 |    6548 | 12710 | 19741 |    0.3201268812552062 |   89.79494041534107
 138 |      138 |     20297 |    6548 | 14195 | 19743 |   0.49508260952955185 |   90.11506729659628
 139 |      139 |     20297 |    6548 | 14196 | 19744 |   0.48439496686567235 |   90.61014990612583
 140 |      140 |     20297 |    6548 | 14197 | 19745 |    0.4169018723910478 |    91.0945448729915
 141 |      141 |     20297 |    6548 | 14198 |  9813 |    0.1808437523641115 |   91.51144674538256
 142 |      142 |     20297 |    6548 |  6562 | 15879 |   0.02937298113632556 |   91.69229049774667
 143 |      143 |     20297 |    6548 | 11211 |  9805 |   0.21298179959991656 |   91.72166347888299
 144 |      144 |     20297 |    6548 |  6558 |  9800 |     0.521207020386025 |    91.9346452784829
 145 |      145 |     20297 |    6548 |  6555 | 27063 |  0.026989071884391005 |   92.45585229886893
 146 |      146 |     20297 |    6548 | 20413 |  9792 |   0.09676253961561734 |   92.48284137075332
 147 |      147 |     20297 |    6548 |  6548 |    -1 |                     0 |   92.57960391036893
 148 |        1 |     23872 |   12712 | 23872 | 32201 |   0.06805668206097569 |                   0
 149 |        2 |     23872 |   12712 | 13075 |  3157 |   0.36358807862137893 | 0.06805668206097569
 150 |        3 |     23872 |   12712 |  1959 | 27731 |   0.21104501961292096 | 0.43164476068235463
 151 |        4 |     23872 |   12712 | 21023 | 12148 |    1.5631200018908398 |  0.6426897802952756
 152 |        5 |     23872 |   12712 |  8266 |  1650 |    0.3486342960360121 |  2.2058097821861153
 153 |        6 |     23872 |   12712 |   981 | 12150 |   0.23223478879647236 |  2.5544440782221276
 154 |        7 |     23872 |   12712 |  8268 | 13776 |    0.8542068022962522 |     2.7866788670186
 155 |        8 |     23872 |   12712 |  9563 | 26702 |    0.1410343012004297 |   3.640885669314852
 156 |        9 |     23872 |   12712 | 20053 |  1649 |    0.8961587100922042 |  3.7819199705152817
 157 |       10 |     23872 |   12712 |   980 | 27759 |    1.8210516080092494 |   4.678078680607486
 158 |       11 |     23872 |   12712 | 21058 |  1646 |    0.2491760231624967 |   6.499130288616735
 159 |       12 |     23872 |   12712 |   978 | 18330 |    1.7640470015322234 |   6.748306311779232
 160 |       13 |     23872 |   12712 | 13086 |   194 |   0.30480055546417956 |   8.512353313311456
 161 |       14 |     23872 |   12712 |   115 | 18333 |   0.32674651452742576 |   8.817153868775636
 162 |       15 |     23872 |   12712 | 13088 |  3203 |    1.7942834158716068 |    9.14390038330306
 163 |       16 |     23872 |   12712 |  1987 | 10373 |    1.9199258375997346 |  10.938183799174668
 164 |       17 |     23872 |   12712 |  6969 | 16507 |    0.2303077324825455 |  12.858109636774403
 165 |       18 |     23872 |   12712 | 11677 | 16935 |    0.5656413215656309 |  13.088417369256948
 166 |       19 |     23872 |   12712 | 11991 | 18342 |    0.1483856605116069 |  13.654058690822579
 167 |       20 |     23872 |   12712 | 13096 |  2709 |   0.15651144982786416 |  13.802444351334186
 168 |       21 |     23872 |   12712 |  1668 | 21057 |    0.9604341412273633 |   13.95895580116205
 169 |       22 |     23872 |   12712 | 15117 | 18336 |   0.26410208559147896 |  14.919389942389413
 170 |       23 |     23872 |   12712 | 13091 | 27191 |    1.0227463380083683 |  15.183492027980892
 171 |       24 |     23872 |   12712 | 20539 | 12740 |    0.7757825119236388 |   16.20623836598926
 172 |       25 |     23872 |   12712 |  8746 |   627 |   0.16355741867056425 |    16.9820208779129
 173 |       26 |     23872 |   12712 |   368 | 15143 |     1.125270605856866 |  17.145578296583462
 174 |       27 |     23872 |   12712 | 10665 | 15144 |    0.2914794552838489 |  18.270848902440328
 175 |       28 |     23872 |   12712 | 10666 | 26215 |    0.1871910369585799 |  18.562328357724176
 176 |       29 |     23872 |   12712 | 19564 |  1403 |    0.9732351612779111 |  18.749519394682757
 177 |       30 |     23872 |   12712 |   845 |  3231 |    0.6829720712229579 |   19.72275455596067
 178 |       31 |     23872 |   12712 |  2008 | 27172 |     0.527060557496736 |   20.40572662718363
 179 |       32 |     23872 |   12712 | 20522 | 27174 |    0.5852416555437366 |  20.932787184680365
 180 |       33 |     23872 |   12712 | 20523 | 27175 |   0.25823694823881754 |    21.5180288402241
 181 |       34 |     23872 |   12712 | 20524 | 27179 |   0.09444897246840468 |   21.77626578846292
 182 |       35 |     23872 |   12712 | 20527 | 27178 |    0.1351106844674789 |  21.870714760931325
 183 |       36 |     23872 |   12712 | 20526 | 27177 |   0.17491610566208335 |  22.005825445398802
 184 |       37 |     23872 |   12712 | 20525 | 13654 |    0.7630859366178266 |  22.180741551060887
 185 |       38 |     23872 |   12712 |  9462 | 18921 |    0.3314009657264923 |  22.943827487678714
 186 |       39 |     23872 |   12712 | 13553 | 22261 |    0.6752680796377302 |  23.275228453405205
 187 |       40 |     23872 |   12712 | 16118 |   680 |    0.7006899730088552 |  23.950496533042937
 188 |       41 |     23872 |   12712 |   405 | 11307 |     1.321002279113034 |  24.651186506051793
 189 |       42 |     23872 |   12712 |  7626 | 22264 |    0.4151765086045739 |   25.97218878516483
 190 |       43 |     23872 |   12712 | 16120 | 18915 |   0.15895986339925208 |  26.387365293769403
 191 |       44 |     23872 |   12712 | 13548 |   400 |   0.30978776129466296 |  26.546325157168656
 192 |       45 |     23872 |   12712 |   242 |  8111 |     1.019570307783051 |   26.85611291846332
 193 |       46 |     23872 |   12712 |  5336 | 18920 |     0.737069125803382 |  27.875683226246373
 194 |       47 |     23872 |   12712 | 13552 |   129 |     1.160317563317828 |  28.612752352049757
 195 |       48 |     23872 |   12712 |    73 | 23872 |    1.4999309043502846 |  29.773069915367586
 196 |       49 |     23872 |   12712 | 17545 |   133 |    2.5416720886879456 |  31.273000819717872
 197 |       50 |     23872 |   12712 |    75 |  8069 |    1.3341011720340759 |   33.81467290840582
 198 |       51 |     23872 |   12712 |  5343 | 13553 |    0.5901569955725334 |   35.14877408043989
 199 |       52 |     23872 |   12712 |  9383 | 26190 |    0.9976039429508339 |   35.73893107601243
 200 |       53 |     23872 |   12712 | 19540 | 20372 |    0.3673098782657977 |   36.73653501896326
 201 |       54 |     23872 |   12712 | 14633 |  1209 |    1.3869035592666186 |   37.10384489722906
 202 |       55 |     23872 |   12712 |   730 |  8118 |    0.5480203595774447 |   38.49074845649568
 203 |       56 |     23872 |   12712 |  5340 |  8120 |   0.24661536332537454 |   39.03876881607312
 204 |       57 |     23872 |   12712 |  5341 |  1407 |    0.9011935849719097 |    39.2853841793985
 205 |       58 |     23872 |   12712 |   847 | 23627 |     0.851447391657154 |  40.186577764370405
 206 |       59 |     23872 |   12712 | 17326 |  1201 |    1.0407105655184872 |   41.03802515602756
 207 |       60 |     23872 |   12712 |   725 |  1593 |    0.7549616786772835 |  42.078735721546046
 208 |       61 |     23872 |   12712 |   945 |  1188 |    0.8973447981353181 |   42.83369740022333
 209 |       62 |     23872 |   12712 |   719 |  1546 |    1.6264734573443969 |  43.731042198358644
 210 |       63 |     23872 |   12712 |   921 |  1185 |    1.6991371093296281 |   45.35751565570304
 211 |       64 |     23872 |   12712 |   718 |  1184 |    1.8421736843279646 |  47.056652765032666
 212 |       65 |     23872 |   12712 |   717 |  1183 |    0.1756919131137854 |  48.898826449360634
 213 |       66 |     23872 |   12712 |   716 | 23660 |    1.8123985785207926 |   49.07451836247442
 214 |       67 |     23872 |   12712 | 17357 | 23659 |   0.36273817018997895 |  50.886916940995214
 215 |       68 |     23872 |   12712 | 17356 |  1167 |     0.626156991097495 |   51.24965511118519
 216 |       69 |     23872 |   12712 |   707 | 27647 |    0.8387670351127208 |   51.87581210228269
 217 |       70 |     23872 |   12712 | 20941 | 16702 |   0.12894862835814783 |   52.71457913739541
 218 |       71 |     23872 |   12712 | 11812 | 11567 |   0.07991115929950714 |   52.84352776575356
 219 |       72 |     23872 |   12712 |  7833 | 11569 |    1.0024513512787812 |   52.92343892505306
 220 |       73 |     23872 |   12712 |  7834 | 27106 |   0.09733636113547829 |   53.92589027633184
 221 |       74 |     23872 |   12712 | 20457 | 27105 |   0.11538771350389099 |   54.02322663746732
 222 |       75 |     23872 |   12712 | 20456 | 28791 |   0.04677187008474406 |   54.13861435097121
 223 |       76 |     23872 |   12712 | 23137 | 30882 |   0.03792144529170564 |   54.18538622105596
 224 |       77 |     23872 |   12712 | 23067 | 30752 |   0.01528834893135846 |  54.223307666347665
 225 |       78 |     23872 |   12712 | 23136 | 30880 |   0.25934575584305203 |   54.23859601527902
 226 |       79 |     23872 |   12712 | 23132 | 30859 |    0.6112590697292155 |   54.49794177112207
 227 |       80 |     23872 |   12712 | 23125 | 28782 |  0.024489716732977097 |   55.10920084085129
 228 |       81 |     23872 |   12712 | 20502 | 30861 |    0.0258239878525215 |  55.133690557584266
 229 |       82 |     23872 |   12712 | 23126 | 30851 |   0.10226185353781583 |  55.159514545436785
 230 |       83 |     23872 |   12712 | 23120 | 30839 |    0.2107442226358855 |  55.261776398974604
 231 |       84 |     23872 |   12712 | 23114 | 30841 |    0.2148926523942987 |   55.47252062161049
 232 |       85 |     23872 |   12712 | 23115 | 28774 |  0.028254750132349193 |   55.68741327400479
 233 |       86 |     23872 |   12712 | 20498 | 30868 |    0.0309845027976242 |   55.71566802413714
 234 |       87 |     23872 |   12712 | 23130 | 30845 |    0.3343040635083571 |   55.74665252693476
 235 |       88 |     23872 |   12712 | 23117 | 30846 |   0.04791976997230444 |  56.080956590443115
 236 |       89 |     23872 |   12712 | 23118 | 30886 |  0.033789572101410564 |   56.12887636041542
 237 |       90 |     23872 |   12712 | 23139 | 28792 |   0.10716538466016473 |   56.16266593251683
 238 |       91 |     23872 |   12712 | 20495 | 18537 |  0.008849574550625895 |  56.269831317176994
 239 |       92 |     23872 |   12712 | 13243 | 18536 |    0.8153302914795523 |   56.27868089172762
 240 |       93 |     23872 |   12712 |   901 |  1508 |     0.628403335656021 |   57.09401118320717
 241 |       94 |     23872 |   12712 |   904 |  1515 |    1.0419783628717416 |    57.7224145188632
 242 |       95 |     23872 |   12712 |   712 |  1176 |    0.7730201625706823 |  58.764392881734935
 243 |       96 |     23872 |   12712 |  8328 | 12226 |   0.17910962720385096 |  59.537413044305616
 244 |       97 |     23872 |   12712 |  8329 |  1520 |    1.3883761676173587 |  59.716522671509466
 245 |       98 |     23872 |   12712 |   906 |  1523 |    0.5576579571323116 |  61.104898839126825
 246 |       99 |     23872 |   12712 |   908 |  1522 |       0.6745418451959 |   61.66255679625914
 247 |      100 |     23872 |   12712 |   907 | 10223 |    0.6106547698405649 |  62.337098641455036
 248 |      101 |     23872 |   12712 |  6870 | 12657 |     0.803456372221048 |    62.9477534112956
 249 |      102 |     23872 |   12712 |  8685 | 27668 |   0.15245781715466927 |   63.75120978351665
 250 |      103 |     23872 |   12712 | 20961 | 31660 |    0.1446698121111374 |   63.90366760067132
 251 |      104 |     23872 |   12712 | 20960 | 21131 |   0.19737210502454586 |   64.04833741278246
 252 |      105 |     23872 |   12712 | 15166 | 23611 |    0.2994933055952417 |     64.245709517807
 253 |      106 |     23872 |   12712 | 17308 | 21132 |   0.07274531629683242 |   64.54520282340225
 254 |      107 |     23872 |   12712 | 15167 | 21129 |    0.3042227143077509 |   64.61794813969908
 255 |      108 |     23872 |   12712 | 15164 | 21128 |   0.24630604483713806 |   64.92217085400684
 256 |      109 |     23872 |   12712 |  8410 | 17834 |     2.588166696930492 |   65.16847689884398
 257 |      110 |     23872 |   12712 | 12712 |    -1 |                     0 |   67.75664359577446
(257 rows)

2.2. pgr_dijkstraCost

When the main goal is to calculate the total cost, without “inspecting” the pgr_dijkstra results, using pgr_dijkstraCost returns a more compact result.

Signature Summary

pgr_dijkstraCost(edges_sql, start_vid,  end_vid  [, directed])
pgr_dijkstraCost(edges_sql, start_vid,  end_vids [, directed])
pgr_dijkstraCost(edges_sql, start_vids, end_vid  [, directed])
pgr_dijkstraCost(edges_sql, start_vids, end_vids [, directed])
pgr_dijkstraCost(edges_sql, combinations_sql   [, directed])

RETURNS SET OF (start_vid, end_vid, agg_cost)
    OR EMPTY SET

Description of the parameters can be found in pgr_dijkstraCost

2.2.1. Exercise 6: Time for many Pedestrians going to different destinations

Problem:

  • Walking

    • from “Hangar Convention Center” or “Instituto Federal do Pará, Campus Belém”

    • to “Forte do Castelo” or “Estação das Docas”

  • Get only the cost in minutes.

From the hotels to the |place_4| and |place_5|

Solution:

  • The pedestrians depart from 20297 and 23872 (line 9).

  • The pedestrians want to go to destinations 6548 and 12712 (line 10).

  • The cost to be in minutes, with a walking speed s = 1.3 m/s and t = d/s (line 6).

  • Result as aggregated costs.

SELECT * FROM pgr_dijkstraCost(
  '
    SELECT gid AS id,
      source,
      target,
      length_m / 1.3 / 60 AS cost    -- line 6
    FROM ways
  ',
  ARRAY[20297, 23872], -- line 9
  ARRAY[6548, 12712], -- line 10
  directed := false);
 start_vid | end_vid |     agg_cost      
-----------+---------+-------------------
     20297 |    6548 | 92.57960391036893
     20297 |   12712 | 83.17687399444317
     23872 |    6548 | 76.26096450425953
     23872 |   12712 | 67.75664359577446
(4 rows)

Compare with Exercise 4: Many Pedestrians going to different destinations ‘s note.

2.2.2. Exercise 7: Many Pedestrians going to different destinations summarizing the total costs per departure

Problem:

  • Walking

    • from “Hangar Convention Center” or “Instituto Federal do Pará, Campus Belém”

    • to “Forte do Castelo” or “Estação das Docas”

  • Summarize cost in minutes.

Solution:

  • The pedestrians depart from 20297 and 23872 (line 9).

  • The pedestrians want to go to destinations 6548 and 12712 (line 10).

  • The cost to be in minutes, with a walking speed s = 1.3 m/s and t = d/s (line 6).

  • Result adds the costs per destination.

SELECT start_vid, sum(agg_cost) FROM pgr_dijkstraCost(
  '
    SELECT gid AS id,
      source,
      target,
      length_m / 1.3 / 60 AS cost -- line 6
    FROM ways
  ',
  ARRAY[20297, 23872], -- line 9
  ARRAY[6548, 12712], -- line 10
  directed := false)
GROUP BY start_vid
ORDER BY start_vid;
 start_vid |        sum        
-----------+-------------------
     20297 | 175.7564779048121
     23872 |  144.017608100034
(2 rows)

Note

An interpretation of the result can be: In general, it is faster to depart from “Instituto Federal do Pará, Campus Belém” than from “Hangar Convention Center”