13. Appendix: Workshop Solutions

13.1. pgRouting Algorithms Solutions

13.1.1. Solution to Exercise 1

Exercise 1

 seq | path_seq | node  | edge  |         cost         |       agg_cost       
-----+----------+-------+-------+----------------------+----------------------
   1 |        1 |   279 |  4181 | 0.000469304698459143 |                    0
   2 |        2 |  7280 |  4182 | 0.000361582330357484 | 0.000469304698459143
   3 |        3 |  4639 |  9848 |  0.00105479171877467 | 0.000830887028816627
   4 |        4 | 12224 | 14318 |  0.00220713385175832 |   0.0018856787475913
   5 |        5 |  5124 |  2938 |  0.00053839446664041 |  0.00409281259934961
   6 |        6 |  1721 | 14799 | 4.33263199457023e-05 |  0.00463120706599002
   7 |        7 |  3186 | 15052 |  5.4849339101133e-05 |  0.00467453338593573
   8 |        8 |   696 |  7579 | 0.000394173366297663 |  0.00472938272503686
   9 |        9 | 11317 |   789 | 0.000563903929945326 |  0.00512355609133452
  10 |       10 |  1315 |  8355 |  7.5896310845478e-05 |  0.00568746002127985
  11 |       11 |  2015 | 13339 | 0.000175926177697688 |  0.00576335633212533
  12 |       12 | 10531 |  5711 |  0.00058124326232598 |  0.00593928250982301
  13 |       13 |  9984 | 10670 | 0.000132512112654024 |  0.00652052577214899
  14 |       14 |  6002 |  1884 | 0.000173957351095451 |  0.00665303788480302
  15 |       15 |  3224 |  2139 | 0.000349494825639744 |  0.00682699523589847
  16 |       16 |  3657 |  6834 | 0.000177928356370073 |  0.00717649006153821
  17 |       17 | 11993 | 22931 |  0.00059148580755913 |  0.00735441841790828
  18 |       18 | 16826 |    -1 |                    0 |  0.00794590422546741
(18 rows)

13.1.2. Solution to Exercise 2

Exercise 2

 seq | path_seq | start_vid | node  | edge  |       cost        |     agg_cost     
-----+----------+-----------+-------+-------+-------------------+------------------
   1 |        1 |       279 |   279 |  4181 |  49.2093404124142 |                0
   2 |        2 |       279 |  7280 |  4182 |  30.9597559891833 | 49.2093404124142
   3 |        3 |       279 |  4639 |  9848 |  85.0008096806676 | 80.1690964015975
   4 |        4 |       279 | 12224 | 14318 |  178.154056616789 | 165.169906082265
   5 |        5 |       279 |  5124 |  2938 |  44.6906204365341 | 343.323962699054
   6 |        6 |       279 |  1721 | 14799 |  4.77534721394922 | 388.014583135588
   7 |        7 |       279 |  3186 | 15052 |  5.72709951473829 | 392.789930349537
   8 |        8 |       279 |   696 |  7579 |  33.2881585132037 | 398.517029864276
   9 |        9 |       279 | 11317 |   789 |  54.2084983149276 | 431.805188377479
  10 |       10 |       279 |  1315 |  8355 |  7.84296205080804 | 486.013686692407
  11 |       11 |       279 |  2015 | 13339 |  14.4325622330332 | 493.856648743215
  12 |       12 |       279 | 10531 |  5711 |   47.873701245529 | 508.289210976248
  13 |       13 |       279 |  9984 | 10670 |  10.9149186344809 | 556.162912221777
  14 |       14 |       279 |  6002 |  1884 |  18.1838156591823 | 567.077830856258
  15 |       15 |       279 |  3224 |  2139 |  36.9582714120303 |  585.26164651544
  16 |       16 |       279 |  3657 |  6834 |  15.7194214630134 | 622.219917927471
  17 |       17 |       279 | 11993 | 22931 |  58.9630808625321 | 637.939339390484
  18 |       18 |       279 | 16826 |    -1 |                 0 | 696.902420253016
  19 |        1 |     13734 | 13734 | 19401 |  9.23503831907335 |                0
  20 |        2 |     13734 | 13680 | 21119 | 0.637428675845302 | 9.23503831907335
  21 |        3 |     13734 | 15203 | 18863 |  1.07660255336651 | 9.87246699491865
  22 |        4 |     13734 | 13198 | 16780 |  7.88326639072665 | 10.9490695482852
  23 |        5 |     13734 | 11998 |  6838 |  1.87795635932793 | 18.8323359390118
  24 |        6 |     13734 |   765 |   462 |  141.087803282183 | 20.7102922983397
  25 |        7 |     13734 |  9801 |  5612 |  9.26204797953308 | 161.798095580523
  26 |        8 |     13734 |  8961 |  5148 |  111.259934964002 | 171.060143560056
  27 |        9 |     13734 |  8619 | 12195 |   63.796945524318 | 282.320078524058
  28 |       10 |     13734 |  6208 |  6915 |  77.5626411662853 | 346.117024048376
  29 |       11 |     13734 | 12130 |  6916 |  22.6195893925259 | 423.679665214661
  30 |       12 |     13734 |  1109 |  7838 |   7.7410348718727 | 446.299254607187
  31 |       13 |     13734 |  2287 | 14589 |  4.80058016267429 |  454.04028947906
  32 |       14 |     13734 |   379 |   215 |  15.0093373578267 | 458.840869641734
  33 |       15 |     13734 |  9773 | 12872 |  15.7478214206794 |  473.85020699956
  34 |       16 |     13734 |  5631 | 12794 |  26.6602317825681 |  489.59802842024
  35 |       17 |     13734 |  9622 | 13270 |  27.5175004055738 | 516.258260202808
  36 |       18 |     13734 | 10415 | 13269 |  11.3059383429239 | 543.775760608382
  37 |       19 |     13734 |  1872 |  1112 |  9.44039537963907 | 555.081698951306
  38 |       20 |     13734 |  6714 |  2793 |  5.91882862803831 | 564.522094330945
  39 |       21 |     13734 |  4867 | 19621 |  8.13939051641936 | 570.440922958983
  40 |       22 |     13734 | 13878 | 17011 |  45.0092300744167 | 578.580313475403
  41 |       23 |     13734 |  9984 | 10670 |  10.9149186344809 | 623.589543549819
  42 |       24 |     13734 |  6002 |  1884 |  18.1838156591823 |   634.5044621843
  43 |       25 |     13734 |  3224 |  2139 |  36.9582714120303 | 652.688277843483
  44 |       26 |     13734 |  3657 |  6834 |  15.7194214630134 | 689.646549255513
  45 |       27 |     13734 | 11993 | 22931 |  58.9630808625321 | 705.365970718526
  46 |       28 |     13734 | 16826 |    -1 |                 0 | 764.329051581058
(46 rows)

13.1.3. Solution to Exercise 3

Exercise 3

 seq | path_seq | end_vid | node  | edge  |       cost        |     agg_cost     
-----+----------+---------+-------+-------+-------------------+------------------
   1 |        1 |     279 | 16826 | 22931 |  45.3562160481016 |                0
   2 |        2 |     279 | 11993 |  6834 |  12.0918626638565 | 45.3562160481016
   3 |        3 |     279 |  3657 |  2139 |  28.4294395477157 | 57.4480787119581
   4 |        4 |     279 |  3224 |  1884 |  13.9875505070633 | 85.8775182596738
   5 |        5 |     279 |  6002 | 10670 |  8.39609125729297 | 99.8650687667371
   6 |        6 |     279 |  9984 |  5711 |  36.8259240350223 |  108.26116002403
   7 |        7 |     279 | 10531 | 13339 |  11.1019709484871 | 145.087084059052
   8 |        8 |     279 |  2015 |  8355 |   6.0330477313908 | 156.189055007539
   9 |        9 |     279 |  1315 |   789 |  41.6988448576366 |  162.22210273893
  10 |       10 |     279 | 11317 |  7579 |  25.6062757793874 | 203.920947596567
  11 |       11 |     279 |   696 | 15052 |   4.4054611651833 | 229.527223375954
  12 |       12 |     279 |  3186 | 14799 |  3.67334401073017 | 233.932684541138
  13 |       13 |     279 |  1721 |  2938 |  34.3774003357954 | 237.606028551868
  14 |       14 |     279 |  5124 | 14318 |  137.041582012915 | 271.983428887663
  15 |       15 |     279 | 12224 |  9848 |  65.3852382158982 | 409.025010900578
  16 |       16 |     279 |  4639 |  4182 |  23.8151969147564 | 474.410249116476
  17 |       17 |     279 |  7280 |  4181 |  37.8533387787801 | 498.225446031232
  18 |       18 |     279 |   279 |    -1 |                 0 | 536.078784810013
  19 |        1 |   13734 | 16826 | 22931 |  45.3562160481016 |                0
  20 |        2 |   13734 | 11993 |  6834 |  12.0918626638565 | 45.3562160481016
  21 |        3 |   13734 |  3657 |  2139 |  28.4294395477157 | 57.4480787119581
  22 |        4 |   13734 |  3224 |  1884 |  13.9875505070633 | 85.8775182596738
  23 |        5 |   13734 |  6002 | 10670 |  8.39609125729297 | 99.8650687667371
  24 |        6 |   13734 |  9984 | 17011 |  34.6224846726283 |  108.26116002403
  25 |        7 |   13734 | 13878 | 19621 |  6.26106962801489 | 142.883644696658
  26 |        8 |   13734 |  4867 |  2793 |  4.55294509849101 | 149.144714324673
  27 |        9 |   13734 |  6714 |  1112 |  7.26184259972236 | 153.697659423164
  28 |       10 |   13734 |  1872 | 13269 |  8.69687564840302 | 160.959502022887
  29 |       11 |   13734 | 10415 | 13270 |  21.1673080042875 |  169.65637767129
  30 |       12 |   13734 |  9622 | 12794 |  20.5078706019755 | 190.823685675577
  31 |       13 |   13734 |  5631 | 12872 |   12.113708785138 | 211.331556277553
  32 |       14 |   13734 |  9773 |   215 |  11.5456441214051 | 223.445265062691
  33 |       15 |   13734 |   379 | 14589 |  3.69275397128792 | 234.990909184096
  34 |       16 |   13734 |  2287 |  7838 |  5.95464220913285 | 238.683663155384
  35 |       17 |   13734 |  1109 |  6916 |  17.3996841480968 | 244.638305364517
  36 |       18 |   13734 | 12130 |  6915 |  59.6635701279118 | 262.037989512613
  37 |       19 |   13734 |  6208 | 12195 |  49.0745734802446 | 321.701559640525
  38 |       20 |   13734 |  8619 |  5148 |  85.5845653569243 |  370.77613312077
  39 |       21 |   13734 |  8961 |  5612 |  7.12465229194852 | 456.360698477694
  40 |       22 |   13734 |  9801 |   462 |  108.529079447833 | 463.485350769643
  41 |       23 |   13734 |   765 |  6838 |  1.44458181486763 | 572.014430217476
  42 |       24 |   13734 | 11998 | 16780 |  6.06405106978973 | 573.459012032344
  43 |       25 |   13734 | 13198 | 18863 | 0.828155810281934 | 579.523063102133
  44 |       26 |   13734 | 15203 | 21119 | 0.490329750650232 | 580.351218912415
  45 |       27 |   13734 | 13680 | 19401 |  7.10387563005642 | 580.841548663065
  46 |       28 |   13734 | 13734 |    -1 |                 0 | 587.945424293122
(46 rows)

13.1.4. Solution to Exercise 4

Exercise 4

 seq | path_seq | start_vid | end_vid | node  | edge  |        cost         |      agg_cost      
-----+----------+-----------+---------+-------+-------+---------------------+--------------------
   1 |        1 |      3986 |    8401 |  3986 |  4467 |   0.161133306860109 |                  0
   2 |        2 |      3986 |    8401 |  7780 | 16030 |    0.16936968062367 |  0.161133306860109
   3 |        3 |      3986 |    8401 |  9344 | 22447 |   0.485235111173952 |  0.330502987483778
   4 |        4 |      3986 |    8401 | 16395 | 17920 |      2.790644860804 |  0.815738098657731
   5 |        5 |      3986 |    8401 |  4291 |  8318 |    1.05176333800187 |   3.60638295946173
   6 |        6 |      3986 |    8401 |  1934 | 12769 |   0.222057483543295 |   4.65814629746359
   7 |        7 |      3986 |    8401 |  9579 | 13576 |    0.20002077408362 |   4.88020378100689
   8 |        8 |      3986 |    8401 | 11002 |   408 |   0.140462672376205 |   5.08022455509051
   9 |        9 |      3986 |    8401 |   671 |   709 |   0.556904603765521 |   5.22068722746671
  10 |       10 |      3986 |    8401 |  1183 |  5517 |   0.217508134907338 |   5.77759183123223
  11 |       11 |      3986 |    8401 |  9647 |   564 |    0.24488546060778 |   5.99509996613957
  12 |       12 |      3986 |    8401 |   923 |  6391 |   0.280879549846382 |   6.23998542674735
  13 |       13 |      3986 |    8401 | 11175 | 10676 |    0.25371610825345 |   6.52086497659373
  14 |       14 |      3986 |    8401 |  6014 | 21032 |   0.171654520135411 |   6.77458108484718
  15 |       15 |      3986 |    8401 | 15128 | 19869 |    0.15391335880932 |   6.94623560498259
  16 |       16 |      3986 |    8401 | 14097 | 17088 |   0.280780130034953 |   7.10014896379191
  17 |       17 |      3986 |    8401 | 10853 | 15494 |   0.627264094849782 |   7.38092909382687
  18 |       18 |      3986 |    8401 |  5975 | 22047 |    1.51327137371649 |   8.00819318867665
  19 |       19 |      3986 |    8401 | 16047 | 18650 |   0.638294888869524 |   9.52146456239313
  20 |       20 |      3986 |    8401 | 13009 | 16713 |    0.16539054818796 |   10.1597594512627
  21 |       21 |      3986 |    8401 |  1294 | 11128 |   0.177237891228691 |   10.3251499994506
  22 |       22 |      3986 |    8401 |  6779 | 14278 |    4.80192405840516 |   10.5023878906793
  23 |       23 |      3986 |    8401 | 12153 | 15669 |   0.937742123977812 |   15.3043119490845
  24 |       24 |      3986 |    8401 |  7146 | 15996 |  0.0856267311726189 |   16.2420540730623
  25 |       25 |      3986 |    8401 |  9150 |  9567 |   0.179801036477885 |   16.3276808042349
  26 |       26 |      3986 |    8401 |  4154 |  4192 |   0.136985015861821 |   16.5074818407128
  27 |       27 |      3986 |    8401 |  7295 |  4714 |    1.70584103732463 |   16.6444668565746
  28 |       28 |      3986 |    8401 |  8210 |  7817 |  0.0773346127471821 |   18.3503078938992
  29 |       29 |      3986 |    8401 |  1072 |  8665 |    1.43953888126824 |   18.4276425066464
  30 |       30 |      3986 |    8401 |  2565 |  4605 |   0.542103743249334 |   19.8671813879147
  31 |       31 |      3986 |    8401 |  8007 | 16445 |   0.530053299206911 |    20.409285131164
  32 |       32 |      3986 |    8401 | 11924 | 14995 |    1.73164611278677 |   20.9393384303709
  33 |       33 |      3986 |    8401 |  2845 | 14833 |    1.21987604262437 |   22.6709845431577
  34 |       34 |      3986 |    8401 |  1897 | 18665 |    1.28260132631578 |   23.8908605857821
  35 |       35 |      3986 |    8401 | 13023 | 20288 |   0.791362309747036 |   25.1734619120978
  36 |       36 |      3986 |    8401 | 14466 | 19629 |    1.06012518170321 |   25.9648242218449
  37 |       37 |      3986 |    8401 | 13885 | 18666 |   0.151521842041285 |   27.0249494035481
  38 |       38 |      3986 |    8401 | 13024 | 16719 |   0.662858781959016 |   27.1764712455894
  39 |       39 |      3986 |    8401 |  5861 | 15365 |   0.426637549603358 |   27.8393300275484
  40 |       40 |      3986 |    8401 |  5157 | 22180 |   0.210285774718142 |   28.2659675771517
  41 |       41 |      3986 |    8401 | 16170 | 18204 |  0.0407332655227849 |   28.4762533518699
  42 |       42 |      3986 |    8401 | 12632 | 16589 |   0.135998655862203 |   28.5169866173927
  43 |       43 |      3986 |    8401 |  3856 | 11059 |   0.275874382444124 |   28.6529852732549
  44 |       44 |      3986 |    8401 |  6682 |  5782 |  0.0578486920848432 |    28.928859655699
  45 |       45 |      3986 |    8401 | 10132 |  6782 |    1.32753872531642 |   28.9867083477838
  46 |       46 |      3986 |    8401 | 11897 |  7909 |    2.14328650428699 |   30.3142470731003
  47 |       47 |      3986 |    8401 |  1235 |  9487 |    1.33144283482052 |   32.4575335773872
  48 |       48 |      3986 |    8401 |  3993 | 16580 |   0.331723653709408 |   33.7889764122078
  49 |       49 |      3986 |    8401 | 12615 | 18185 |  0.0380565510302926 |   34.1207000659172
  50 |       50 |      3986 |    8401 |  7294 | 12810 |   0.436489909821736 |   34.1587566169475
  51 |       51 |      3986 |    8401 |  9648 | 16268 |    1.53783969798542 |   34.5952465267692
  52 |       52 |      3986 |    8401 | 10748 |  7241 |  0.0461752495622531 |   36.1330862247546
  53 |       53 |      3986 |    8401 |   144 |  4618 |   0.107953673235561 |   36.1792614743169
  54 |       54 |      3986 |    8401 |  8019 |  4815 |   0.318586139183357 |   36.2872151475524
  55 |       55 |      3986 |    8401 |  8401 |    -1 |                   0 |   36.6058012867358
  56 |        1 |      3986 |   12235 |  3986 |  2307 |  0.0879093504356578 |                  0
  57 |        2 |      3986 |   12235 |  7899 |  5959 |   0.405550388852438 | 0.0879093504356578
  58 |        3 |      3986 |   12235 | 10434 |  5960 |  0.0953072002067002 |  0.493459739288095
  59 |        4 |      3986 |   12235 |   302 |   291 |    3.62885065650794 |  0.588766939494795
  60 |        5 |      3986 |   12235 |   502 |  9097 |    0.68053805592633 |   4.21761759600273
  61 |        6 |      3986 |   12235 |  3329 | 16489 |    0.68554650782557 |   4.89815565192906
  62 |        7 |      3986 |   12235 | 12140 | 16257 |   0.128312832799838 |   5.58370215975463
  63 |        8 |      3986 |   12235 | 10674 | 14583 |   0.190358886081225 |   5.71201499255447
  64 |        9 |      3986 |   12235 |   353 |  7975 |   0.126701731714783 |    5.9023738786357
  65 |       10 |      3986 |   12235 |  1341 | 14075 |   0.536018627358916 |   6.02907561035048
  66 |       11 |      3986 |   12235 | 11786 |  7959 |   0.161701620067918 |   6.56509423770939
  67 |       12 |      3986 |   12235 |  1320 | 22583 |   0.485644386036811 |   6.72679585777731
  68 |       13 |      3986 |   12235 | 16526 | 18470 |   0.478448428916997 |   7.21244024381412
  69 |       14 |      3986 |   12235 | 12844 | 22691 |   0.126005395544857 |   7.69088867273112
  70 |       15 |      3986 |   12235 | 16619 | 22518 |    1.98239576719522 |   7.81689406827598
  71 |       16 |      3986 |   12235 | 16465 | 17945 |   0.439384965704923 |   9.79928983547119
  72 |       17 |      3986 |   12235 |  1354 | 19266 |   0.913955795926114 |   10.2386748011761
  73 |       18 |      3986 |   12235 | 13556 | 16913 |   0.548189888072168 |   11.1526305971022
  74 |       19 |      3986 |   12235 |  7876 | 18363 |    1.42531322898084 |   11.7008204851744
  75 |       20 |      3986 |   12235 | 12756 | 16633 |   0.248455027956015 |   13.1261337141552
  76 |       21 |      3986 |   12235 | 10500 | 15741 |   0.392930199836847 |   13.3745887421113
  77 |       22 |      3986 |   12235 |  7683 | 21367 |     0.3233041476842 |   13.7675189419481
  78 |       23 |      3986 |   12235 | 15423 | 18829 |   0.617198417778706 |   14.0908230896323
  79 |       24 |      3986 |   12235 | 13170 | 16764 |   0.149847878041422 |    14.708021507411
  80 |       25 |      3986 |   12235 |  2480 |  1129 |   0.156169418895533 |   14.8578693854524
  81 |       26 |      3986 |   12235 |  1907 | 11257 |   0.210446302877348 |    15.014038804348
  82 |       27 |      3986 |   12235 |  7023 |  3235 |   0.170574454719809 |   15.2244851072253
  83 |       28 |      3986 |   12235 |  5664 |  1578 |    1.19598910038433 |   15.3950595619451
  84 |       29 |      3986 |   12235 |  2703 |  9743 |    2.15496069893418 |   16.5910486623295
  85 |       30 |      3986 |   12235 |  4451 | 15277 |    1.09348536599739 |   18.7460093612636
  86 |       31 |      3986 |   12235 |  4634 |   649 |   0.330607779420422 |    19.839494727261
  87 |       32 |      3986 |   12235 |  1076 | 11283 |   0.272022525757874 |   20.1701025066815
  88 |       33 |      3986 |   12235 |  7067 | 15653 |   0.102937253611116 |   20.4421250324393
  89 |       34 |      3986 |   12235 |  1276 |   766 |   0.313027163973043 |   20.5450622860504
  90 |       35 |      3986 |   12235 |  9032 |  5186 |    1.38720640314751 |   20.8580894500235
  91 |       36 |      3986 |   12235 |  4147 |  9563 |   0.632936242111959 |    22.245295853171
  92 |       37 |      3986 |   12235 |  8991 |  5168 |    1.45848670529113 |    22.878232095283
  93 |       38 |      3986 |   12235 |  1262 |   757 |    0.21493024337304 |   24.3367188005741
  94 |       39 |      3986 |   12235 | 11820 |  6739 |   0.107106295139081 |   24.5516490439471
  95 |       40 |      3986 |   12235 |  4759 |  9928 |   0.233742228553807 |   24.6587553390862
  96 |       41 |      3986 |   12235 |  8510 |  4942 |   0.300211174958748 |     24.89249756764
  97 |       42 |      3986 |   12235 |  8609 |  9202 |    7.64616687196628 |   25.1927087425988
  98 |       43 |      3986 |   12235 |  3501 |  6905 |   0.169167465202891 |    32.838875614565
  99 |       44 |      3986 |   12235 | 12092 | 12532 |   0.183196926135654 |   33.0080430797679
 100 |       45 |      3986 |   12235 |  9221 |   816 |    2.83913108980337 |   33.1912400059036
 101 |       46 |      3986 |   12235 |  1363 |  2984 |    1.20716137675091 |    36.030371095707
 102 |       47 |      3986 |   12235 |  5227 |  5021 |    0.21456149594535 |   37.2375324724579
 103 |       48 |      3986 |   12235 |  8753 |  4215 |    2.60226743209893 |   37.4520939684032
 104 |       49 |      3986 |   12235 |  7351 |  7336 |   0.153783644570765 |   40.0543614005021
 105 |       50 |      3986 |   12235 |   286 |  3767 |   0.174830016984609 |   40.2081450450729
 106 |       51 |      3986 |   12235 |  6587 |  3625 |   0.109487174133654 |   40.3829750620575
 107 |       52 |      3986 |   12235 |  6350 |  3626 |   0.116171883409696 |   40.4924622361912
 108 |       53 |      3986 |   12235 | 10625 | 16246 |    0.41854988722936 |   40.6086341196009
 109 |       54 |      3986 |   12235 |   626 | 16661 |   0.449061201243994 |   41.0271840068302
 110 |       55 |      3986 |   12235 | 12849 | 18474 |  0.0530223763336673 |   41.4762452080742
 111 |       56 |      3986 |   12235 | 16637 | 22713 |    2.79869815943204 |   41.5292675844079
 112 |       57 |      3986 |   12235 | 15783 | 21766 |  0.0674838139743969 |   44.3279657438399
 113 |       58 |      3986 |   12235 | 16239 | 19771 | 0.00983466533998695 |   44.3954495578143
 114 |       59 |      3986 |   12235 | 14008 | 19770 |   0.156600498703542 |   44.4052842231543
 115 |       60 |      3986 |   12235 |    40 |  6879 |   0.917203461739565 |   44.5618847218579
 116 |       61 |      3986 |   12235 | 12053 |  6878 |   0.506985258060122 |   45.4790881835974
 117 |       62 |      3986 |   12235 |   517 |   308 |   0.492793705096229 |   45.9860734416575
 118 |       63 |      3986 |   12235 |  9546 | 12744 |    0.13124361138254 |   46.4788671467538
 119 |       64 |      3986 |   12235 |   555 |  7497 |   0.175766600741926 |   46.6101107581363
 120 |       65 |      3986 |   12235 |  7196 | 11340 |    1.63073472134632 |   46.7858773588782
 121 |       66 |      3986 |   12235 |  8561 |  4913 |   0.750056375688835 |   48.4166120802245
 122 |       67 |      3986 |   12235 |  8383 | 12053 |   0.664223310647819 |   49.1666684559134
 123 |       68 |      3986 |   12235 |  6296 |  3586 |   0.592328374067338 |   49.8308917665612
 124 |       69 |      3986 |   12235 |  2577 |  1511 |   0.633260676147584 |   50.4232201406285
 125 |       70 |      3986 |   12235 |  4937 |  2832 |   0.431247076286884 |   51.0564808167761
 126 |       71 |      3986 |   12235 |  2552 |  1500 |   0.247878751780689 |    51.487727893063
 127 |       72 |      3986 |   12235 | 11373 | 13818 |   0.121732348751506 |   51.7356066448437
 128 |       73 |      3986 |   12235 |  5074 | 10113 |    0.95778426564641 |   51.8573389935952
 129 |       74 |      3986 |   12235 |  5816 | 10556 |   0.522397872267841 |   52.8151232592416
 130 |       75 |      3986 |   12235 | 11383 |  6503 |    0.44421401161374 |   53.3375211315094
 131 |       76 |      3986 |   12235 | 10807 |  6175 |   0.135022506115463 |   53.7817351431232
 132 |       77 |      3986 |   12235 | 11923 |  6794 |   0.520121537867506 |   53.9167576492386
 133 |       78 |      3986 |   12235 |  1614 |   966 |   0.630089932422275 |   54.4368791871062
 134 |       79 |      3986 |   12235 |  1141 |  7855 |   0.496445241145688 |   55.0669691195284
 135 |       80 |      3986 |   12235 |  1863 |  8281 |   0.153498570545313 |   55.5634143606741
 136 |       81 |      3986 |   12235 |  2297 | 14903 |    1.40297432166768 |   55.7169129312194
 137 |       82 |      3986 |   12235 |  2322 | 14908 |   0.698269639954301 |   57.1198872528871
 138 |       83 |      3986 |   12235 |   711 |  7592 |   0.747722639266528 |   57.8181568928414
 139 |       84 |      3986 |   12235 |  5593 |  3200 |   0.598086364200089 |   58.5658795321079
 140 |       85 |      3986 |   12235 |  1864 |  1110 |   0.349776884743887 |    59.163965896308
 141 |       86 |      3986 |   12235 |  4712 | 15287 |   0.334274842119314 |   59.5137427810519
 142 |       87 |      3986 |   12235 |  5218 | 15373 |   0.462683745812453 |   59.8480176231712
 143 |       88 |      3986 |   12235 |  8331 | 12385 |  0.0702821419640457 |   60.3107013689837
 144 |       89 |      3986 |   12235 |  8945 | 11655 |  0.0370885696019152 |   60.3809835109477
 145 |       90 |      3986 |   12235 |  7704 |  1917 |    1.02641187878044 |   60.4180720805496
 146 |       91 |      3986 |   12235 |  3288 | 11878 |   0.103454253812616 |   61.4444839593301
 147 |       92 |      3986 |   12235 |  8081 |  9291 |  0.0982824829546381 |   61.5479382131427
 148 |       93 |      3986 |   12235 |  3670 | 13429 |   0.111392809790013 |   61.6462206960973
 149 |       94 |      3986 |   12235 | 10681 | 10233 |  0.0936065406993686 |   61.7576135058873
 150 |       95 |      3986 |   12235 |  5240 |  7436 |   0.159566049565392 |   61.8512200465867
 151 |       96 |      3986 |   12235 |   440 | 11904 |   0.209920679996928 |   62.0107860961521
 152 |       97 |      3986 |   12235 |  8128 |  1143 |   0.131201579702369 |    62.220706776149
 153 |       98 |      3986 |   12235 |  1919 |  8464 |   0.499059474952526 |   62.3519083558514
 154 |       99 |      3986 |   12235 |  2189 | 10224 |    0.35884920634928 |   62.8509678308039
 155 |      100 |      3986 |   12235 |  5231 |   569 |    1.45908388553903 |   63.2098170371532
 156 |      101 |      3986 |   12235 |   931 |   354 |    0.54396279943011 |   64.6689009226922
 157 |      102 |      3986 |   12235 |   598 | 20876 |   0.208689780398848 |   65.2128637221223
 158 |      103 |      3986 |   12235 | 14995 | 17399 |    0.25875943359977 |   65.4215535025212
 159 |      104 |      3986 |   12235 |  2610 | 14889 |    1.90211475631763 |   65.6803129361209
 160 |      105 |      3986 |   12235 |  2232 | 16329 |   0.949598114520113 |   67.5824276924386
 161 |      106 |      3986 |   12235 | 11110 | 14983 |   0.558974312547596 |   68.5320258069587
 162 |      107 |      3986 |   12235 |  2778 | 16336 |   0.591665523686947 |   69.0910001195063
 163 |      108 |      3986 |   12235 | 11171 | 15417 |   0.701631242605844 |   69.6826656431932
 164 |      109 |      3986 |   12235 |  5522 | 22016 |    1.43240479440924 |    70.384296885799
 165 |      110 |      3986 |   12235 | 16019 | 17791 |   0.201718546342412 |   71.8167016802083
 166 |      111 |      3986 |   12235 | 10794 | 11895 |   0.964418451719438 |   72.0184202265507
 167 |      112 |      3986 |   12235 |  8114 | 11894 |    1.06376748639327 |   72.9828386782701
 168 |      113 |      3986 |   12235 |  4352 |  2531 |   0.196528148095362 |   74.0466061646634
 169 |      114 |      3986 |   12235 |  6606 |  3780 |   0.463281833046529 |   74.2431343127588
 170 |      115 |      3986 |   12235 |  9007 |   472 |   0.401291558656676 |   74.7064161458053
 171 |      116 |      3986 |   12235 |   780 | 16505 |    0.36232701663345 |    75.107707704462
 172 |      117 |      3986 |   12235 | 12235 |    -1 |                   0 |   75.4700347210954
 173 |        1 |      9411 |    8401 |  9411 | 17169 |    0.35031651139181 |                  0
 174 |        2 |      9411 |    8401 | 14365 | 20175 |  0.0364036765628157 |   0.35031651139181
 175 |        3 |      9411 |    8401 |  4280 | 17332 |    1.46818038623625 |  0.386720187954626
 176 |        4 |      9411 |    8401 | 14809 | 20669 |   0.287654684058925 |   1.85490057419088
 177 |        5 |      9411 |    8401 | 15632 | 21606 |   0.240506699794369 |    2.1425552582498
 178 |        6 |      9411 |    8401 |  5856 | 15474 |    1.74784560929531 |   2.38306195804417
 179 |        7 |      9411 |    8401 |   108 |  7216 |    1.31099359661729 |   4.13090756733948
 180 |        8 |      9411 |    8401 |  7553 | 11563 |    2.12191955576592 |   5.44190116395677
 181 |        9 |      9411 |    8401 |  7518 | 11543 |  0.0263889259129567 |   7.56382071972268
 182 |       10 |      9411 |    8401 |  2646 | 14967 |   0.269728180359489 |   7.59020964563564
 183 |       11 |      9411 |    8401 |  5137 | 17532 |   0.260920108648915 |   7.85993782599513
 184 |       12 |      9411 |    8401 | 15344 | 21283 |    2.00423493448814 |   8.12085793464404
 185 |       13 |      9411 |    8401 |  1012 | 14687 |    1.10713727924447 |   10.1250928691322
 186 |       14 |      9411 |    8401 |  1656 |   994 |   0.318029621984978 |   11.2322301483767
 187 |       15 |      9411 |    8401 |    96 | 11115 |   0.375610640722748 |   11.5502597703616
 188 |       16 |      9411 |    8401 |  6766 |  5617 |   0.129952997192195 |   11.9258704110844
 189 |       17 |      9411 |    8401 |  9805 |  5615 |   0.178261020209368 |   12.0558234082766
 190 |       18 |      9411 |    8401 | 11914 | 12152 |    1.95810822131343 |   12.2340844284859
 191 |       19 |      9411 |    8401 |  8550 | 12153 |    2.27991119619624 |   14.1921926497994
 192 |       20 |      9411 |    8401 |  1055 |  2362 |   0.153554751838249 |   16.4721038459956
 193 |       21 |      9411 |    8401 |  4300 |  2499 |   0.733976969151736 |   16.6256585978339
 194 |       22 |      9411 |    8401 | 11074 |  6346 |   0.140343602870384 |   17.3596355669856
 195 |       23 |      9411 |    8401 |   234 |   141 |   0.247410398633202 |    17.499979169856
 196 |       24 |      9411 |    8401 |  7161 | 11331 |   0.104648693031829 |   17.7473895684892
 197 |       25 |      9411 |    8401 |  8835 | 11790 |   0.395671789199151 |    17.852038261521
 198 |       26 |      9411 |    8401 |  7927 | 11789 |  0.0925826300713048 |   18.2477100507202
 199 |       27 |      9411 |    8401 |  9344 | 22447 |   0.485235111173952 |   18.3402926807915
 200 |       28 |      9411 |    8401 | 16395 | 17920 |      2.790644860804 |   18.8255277919654
 201 |       29 |      9411 |    8401 |  4291 |  8318 |    1.05176333800187 |   21.6161726527694
 202 |       30 |      9411 |    8401 |  1934 | 12769 |   0.222057483543295 |   22.6679359907713
 203 |       31 |      9411 |    8401 |  9579 | 13576 |    0.20002077408362 |   22.8899934743146
 204 |       32 |      9411 |    8401 | 11002 |   408 |   0.140462672376205 |   23.0900142483982
 205 |       33 |      9411 |    8401 |   671 |   709 |   0.556904603765521 |   23.2304769207744
 206 |       34 |      9411 |    8401 |  1183 |  5517 |   0.217508134907338 |   23.7873815245399
 207 |       35 |      9411 |    8401 |  9647 |   564 |    0.24488546060778 |   24.0048896594473
 208 |       36 |      9411 |    8401 |   923 |  6391 |   0.280879549846382 |   24.2497751200551
 209 |       37 |      9411 |    8401 | 11175 | 10676 |    0.25371610825345 |   24.5306546699014
 210 |       38 |      9411 |    8401 |  6014 | 21032 |   0.171654520135411 |   24.7843707781549
 211 |       39 |      9411 |    8401 | 15128 | 19869 |    0.15391335880932 |   24.9560252982903
 212 |       40 |      9411 |    8401 | 14097 | 17088 |   0.280780130034953 |   25.1099386570996
 213 |       41 |      9411 |    8401 | 10853 | 15494 |   0.627264094849782 |   25.3907187871346
 214 |       42 |      9411 |    8401 |  5975 | 22047 |    1.51327137371649 |   26.0179828819844
 215 |       43 |      9411 |    8401 | 16047 | 18650 |   0.638294888869524 |   27.5312542557008
 216 |       44 |      9411 |    8401 | 13009 | 16713 |    0.16539054818796 |   28.1695491445704
 217 |       45 |      9411 |    8401 |  1294 | 11128 |   0.177237891228691 |   28.3349396927583
 218 |       46 |      9411 |    8401 |  6779 | 14278 |    4.80192405840516 |    28.512177583987
 219 |       47 |      9411 |    8401 | 12153 | 15669 |   0.937742123977812 |   33.3141016423922
 220 |       48 |      9411 |    8401 |  7146 | 15996 |  0.0856267311726189 |     34.25184376637
 221 |       49 |      9411 |    8401 |  9150 |  9567 |   0.179801036477885 |   34.3374704975426
 222 |       50 |      9411 |    8401 |  4154 |  4192 |   0.136985015861821 |   34.5172715340205
 223 |       51 |      9411 |    8401 |  7295 |  4714 |    1.70584103732463 |   34.6542565498823
 224 |       52 |      9411 |    8401 |  8210 |  7817 |  0.0773346127471821 |   36.3600975872069
 225 |       53 |      9411 |    8401 |  1072 |  8665 |    1.43953888126824 |   36.4374321999541
 226 |       54 |      9411 |    8401 |  2565 |  4605 |   0.542103743249334 |   37.8769710812224
 227 |       55 |      9411 |    8401 |  8007 | 16445 |   0.530053299206911 |   38.4190748244717
 228 |       56 |      9411 |    8401 | 11924 | 14995 |    1.73164611278677 |   38.9491281236786
 229 |       57 |      9411 |    8401 |  2845 | 14833 |    1.21987604262437 |   40.6807742364654
 230 |       58 |      9411 |    8401 |  1897 | 18665 |    1.28260132631578 |   41.9006502790898
 231 |       59 |      9411 |    8401 | 13023 | 20288 |   0.791362309747036 |   43.1832516054055
 232 |       60 |      9411 |    8401 | 14466 | 19629 |    1.06012518170321 |   43.9746139151526
 233 |       61 |      9411 |    8401 | 13885 | 18666 |   0.151521842041285 |   45.0347390968558
 234 |       62 |      9411 |    8401 | 13024 | 16719 |   0.662858781959016 |   45.1862609388971
 235 |       63 |      9411 |    8401 |  5861 | 15365 |   0.426637549603358 |   45.8491197208561
 236 |       64 |      9411 |    8401 |  5157 | 22180 |   0.210285774718142 |   46.2757572704594
 237 |       65 |      9411 |    8401 | 16170 | 18204 |  0.0407332655227849 |   46.4860430451776
 238 |       66 |      9411 |    8401 | 12632 | 16589 |   0.135998655862203 |   46.5267763107004
 239 |       67 |      9411 |    8401 |  3856 | 11059 |   0.275874382444124 |   46.6627749665626
 240 |       68 |      9411 |    8401 |  6682 |  5782 |  0.0578486920848432 |   46.9386493490067
 241 |       69 |      9411 |    8401 | 10132 |  6782 |    1.32753872531642 |   46.9964980410915
 242 |       70 |      9411 |    8401 | 11897 |  7909 |    2.14328650428699 |    48.324036766408
 243 |       71 |      9411 |    8401 |  1235 |  9487 |    1.33144283482052 |   50.4673232706949
 244 |       72 |      9411 |    8401 |  3993 | 16580 |   0.331723653709408 |   51.7987661055155
 245 |       73 |      9411 |    8401 | 12615 | 18185 |  0.0380565510302926 |   52.1304897592249
 246 |       74 |      9411 |    8401 |  7294 | 12810 |   0.436489909821736 |   52.1685463102552
 247 |       75 |      9411 |    8401 |  9648 | 16268 |    1.53783969798542 |   52.6050362200769
 248 |       76 |      9411 |    8401 | 10748 |  7241 |  0.0461752495622531 |   54.1428759180623
 249 |       77 |      9411 |    8401 |   144 |  4618 |   0.107953673235561 |   54.1890511676246
 250 |       78 |      9411 |    8401 |  8019 |  4815 |   0.318586139183357 |   54.2970048408601
 251 |       79 |      9411 |    8401 |  8401 |    -1 |                   0 |   54.6155909800435
 252 |        1 |      9411 |   12235 |  9411 | 17169 |    0.35031651139181 |                  0
 253 |        2 |      9411 |   12235 | 14365 | 20175 |  0.0364036765628157 |   0.35031651139181
 254 |        3 |      9411 |   12235 |  4280 |  9786 |   0.142291676316751 |  0.386720187954626
 255 |        4 |      9411 |   12235 |  4525 |  8659 |   0.106996941910394 |  0.529011864271377
 256 |        5 |      9411 |   12235 |  2560 | 14688 |    4.64344386329509 |  0.636008806181771
 257 |        6 |      9411 |   12235 |  1018 |  4387 |    1.81446644405888 |   5.27945266947686
 258 |        7 |      9411 |   12235 |  7633 | 11525 |   0.825451750998187 |   7.09391911353574
 259 |        8 |      9411 |   12235 |  7484 |  4604 |     0.5776658667033 |   7.91937086453393
 260 |        9 |      9411 |   12235 |  8004 | 10294 |    1.06792398803141 |   8.49703673123723
 261 |       10 |      9411 |   12235 |  5363 |  6995 |     0.3209802329846 |   9.56496071926864
 262 |       11 |      9411 |   12235 | 12276 |  4083 |    2.49284876808823 |   9.88594095225324
 263 |       12 |      9411 |   12235 |  7124 | 15025 |   0.108769329549023 |   12.3787897203415
 264 |       13 |      9411 |   12235 |  3024 | 16404 |    0.17607298166287 |   12.4875590498905
 265 |       14 |      9411 |   12235 | 11656 |  9319 |  0.0864840341975803 |   12.6636320315534
 266 |       15 |      9411 |   12235 |  3729 | 21936 |   0.303721522303929 |   12.7501160657509
 267 |       16 |      9411 |   12235 | 15946 | 17769 |   0.304270535135757 |   13.0538375880549
 268 |       17 |      9411 |   12235 |  2972 |  7577 |  0.0896391150195801 |   13.3581081231906
 269 |       18 |      9411 |   12235 |   693 |  7001 |    3.01836914720053 |   13.4477472382102
 270 |       19 |      9411 |   12235 | 12293 |  4882 |   0.214500538399567 |   16.4661163854107
 271 |       20 |      9411 |   12235 |  8510 |  4942 |   0.300211174958748 |   16.6806169238103
 272 |       21 |      9411 |   12235 |  8609 |  9202 |    7.64616687196628 |   16.9808280987691
 273 |       22 |      9411 |   12235 |  3501 |  6905 |   0.169167465202891 |   24.6269949707353
 274 |       23 |      9411 |   12235 | 12092 | 12532 |   0.183196926135654 |   24.7961624359382
 275 |       24 |      9411 |   12235 |  9221 |   816 |    2.83913108980337 |   24.9793593620739
 276 |       25 |      9411 |   12235 |  1363 |  2984 |    1.20716137675091 |   27.8184904518772
 277 |       26 |      9411 |   12235 |  5227 |  5021 |    0.21456149594535 |   29.0256518286281
 278 |       27 |      9411 |   12235 |  8753 |  4215 |    2.60226743209893 |   29.2402133245735
 279 |       28 |      9411 |   12235 |  7351 |  7336 |   0.153783644570765 |   31.8424807566724
 280 |       29 |      9411 |   12235 |   286 |  3767 |   0.174830016984609 |   31.9962644012432
 281 |       30 |      9411 |   12235 |  6587 |  3625 |   0.109487174133654 |   32.1710944182278
 282 |       31 |      9411 |   12235 |  6350 |  3626 |   0.116171883409696 |   32.2805815923615
 283 |       32 |      9411 |   12235 | 10625 | 16246 |    0.41854988722936 |   32.3967534757712
 284 |       33 |      9411 |   12235 |   626 | 16661 |   0.449061201243994 |   32.8153033630005
 285 |       34 |      9411 |   12235 | 12849 | 18474 |  0.0530223763336673 |   33.2643645642445
 286 |       35 |      9411 |   12235 | 16637 | 22713 |    2.79869815943204 |   33.3173869405782
 287 |       36 |      9411 |   12235 | 15783 | 21766 |  0.0674838139743969 |   36.1160851000102
 288 |       37 |      9411 |   12235 | 16239 | 19771 | 0.00983466533998695 |   36.1835689139846
 289 |       38 |      9411 |   12235 | 14008 | 19770 |   0.156600498703542 |   36.1934035793246
 290 |       39 |      9411 |   12235 |    40 |  6879 |   0.917203461739565 |   36.3500040780281
 291 |       40 |      9411 |   12235 | 12053 |  6878 |   0.506985258060122 |   37.2672075397677
 292 |       41 |      9411 |   12235 |   517 |   308 |   0.492793705096229 |   37.7741927978278
 293 |       42 |      9411 |   12235 |  9546 | 12744 |    0.13124361138254 |   38.2669865029241
 294 |       43 |      9411 |   12235 |   555 |  7497 |   0.175766600741926 |   38.3982301143066
 295 |       44 |      9411 |   12235 |  7196 | 11340 |    1.63073472134632 |   38.5739967150485
 296 |       45 |      9411 |   12235 |  8561 |  4913 |   0.750056375688835 |   40.2047314363948
 297 |       46 |      9411 |   12235 |  8383 | 12053 |   0.664223310647819 |   40.9547878120837
 298 |       47 |      9411 |   12235 |  6296 |  3586 |   0.592328374067338 |   41.6190111227315
 299 |       48 |      9411 |   12235 |  2577 |  1511 |   0.633260676147584 |   42.2113394967988
 300 |       49 |      9411 |   12235 |  4937 |  2832 |   0.431247076286884 |   42.8446001729464
 301 |       50 |      9411 |   12235 |  2552 |  1500 |   0.247878751780689 |   43.2758472492333
 302 |       51 |      9411 |   12235 | 11373 | 13818 |   0.121732348751506 |    43.523726001014
 303 |       52 |      9411 |   12235 |  5074 | 10113 |    0.95778426564641 |   43.6454583497655
 304 |       53 |      9411 |   12235 |  5816 | 10556 |   0.522397872267841 |   44.6032426154119
 305 |       54 |      9411 |   12235 | 11383 |  6503 |    0.44421401161374 |   45.1256404876797
 306 |       55 |      9411 |   12235 | 10807 |  6175 |   0.135022506115463 |   45.5698544992935
 307 |       56 |      9411 |   12235 | 11923 |  6794 |   0.520121537867506 |   45.7048770054089
 308 |       57 |      9411 |   12235 |  1614 |   966 |   0.630089932422275 |   46.2249985432764
 309 |       58 |      9411 |   12235 |  1141 |  7855 |   0.496445241145688 |   46.8550884756987
 310 |       59 |      9411 |   12235 |  1863 |  8281 |   0.153498570545313 |   47.3515337168444
 311 |       60 |      9411 |   12235 |  2297 | 14903 |    1.40297432166768 |   47.5050322873897
 312 |       61 |      9411 |   12235 |  2322 | 14908 |   0.698269639954301 |   48.9080066090574
 313 |       62 |      9411 |   12235 |   711 |  7592 |   0.747722639266528 |   49.6062762490117
 314 |       63 |      9411 |   12235 |  5593 |  3200 |   0.598086364200089 |   50.3539988882782
 315 |       64 |      9411 |   12235 |  1864 |  1110 |   0.349776884743887 |   50.9520852524783
 316 |       65 |      9411 |   12235 |  4712 | 15287 |   0.334274842119314 |   51.3018621372222
 317 |       66 |      9411 |   12235 |  5218 | 15373 |   0.462683745812453 |   51.6361369793415
 318 |       67 |      9411 |   12235 |  8331 | 12385 |  0.0702821419640457 |    52.098820725154
 319 |       68 |      9411 |   12235 |  8945 | 11655 |  0.0370885696019152 |    52.169102867118
 320 |       69 |      9411 |   12235 |  7704 |  1917 |    1.02641187878044 |   52.2061914367199
 321 |       70 |      9411 |   12235 |  3288 | 11878 |   0.103454253812616 |   53.2326033155004
 322 |       71 |      9411 |   12235 |  8081 |  9291 |  0.0982824829546381 |    53.336057569313
 323 |       72 |      9411 |   12235 |  3670 | 13429 |   0.111392809790013 |   53.4343400522676
 324 |       73 |      9411 |   12235 | 10681 | 10233 |  0.0936065406993686 |   53.5457328620576
 325 |       74 |      9411 |   12235 |  5240 |  7436 |   0.159566049565392 |    53.639339402757
 326 |       75 |      9411 |   12235 |   440 | 11904 |   0.209920679996928 |   53.7989054523224
 327 |       76 |      9411 |   12235 |  8128 |  1143 |   0.131201579702369 |   54.0088261323193
 328 |       77 |      9411 |   12235 |  1919 |  8464 |   0.499059474952526 |   54.1400277120217
 329 |       78 |      9411 |   12235 |  2189 | 10224 |    0.35884920634928 |   54.6390871869742
 330 |       79 |      9411 |   12235 |  5231 |   569 |    1.45908388553903 |   54.9979363933235
 331 |       80 |      9411 |   12235 |   931 |   354 |    0.54396279943011 |   56.4570202788625
 332 |       81 |      9411 |   12235 |   598 | 20876 |   0.208689780398848 |   57.0009830782926
 333 |       82 |      9411 |   12235 | 14995 | 17399 |    0.25875943359977 |   57.2096728586915
 334 |       83 |      9411 |   12235 |  2610 | 14889 |    1.90211475631763 |   57.4684322922912
 335 |       84 |      9411 |   12235 |  2232 | 16329 |   0.949598114520113 |   59.3705470486089
 336 |       85 |      9411 |   12235 | 11110 | 14983 |   0.558974312547596 |    60.320145163129
 337 |       86 |      9411 |   12235 |  2778 | 16336 |   0.591665523686947 |   60.8791194756766
 338 |       87 |      9411 |   12235 | 11171 | 15417 |   0.701631242605844 |   61.4707849993635
 339 |       88 |      9411 |   12235 |  5522 | 22016 |    1.43240479440924 |   62.1724162419694
 340 |       89 |      9411 |   12235 | 16019 | 17791 |   0.201718546342412 |   63.6048210363786
 341 |       90 |      9411 |   12235 | 10794 | 11895 |   0.964418451719438 |    63.806539582721
 342 |       91 |      9411 |   12235 |  8114 | 11894 |    1.06376748639327 |   64.7709580344405
 343 |       92 |      9411 |   12235 |  4352 |  2531 |   0.196528148095362 |   65.8347255208337
 344 |       93 |      9411 |   12235 |  6606 |  3780 |   0.463281833046529 |   66.0312536689291
 345 |       94 |      9411 |   12235 |  9007 |   472 |   0.401291558656676 |   66.4945355019756
 346 |       95 |      9411 |   12235 |   780 | 16505 |    0.36232701663345 |   66.8958270606323
 347 |       96 |      9411 |   12235 | 12235 |    -1 |                   0 |   67.2581540772657
(347 rows)

13.1.5. Solution to Exercise 5

Exercise 5

 start_vid | end_vid |     agg_cost     
-----------+---------+------------------
      3986 |    8401 | 36.6058012867358
      3986 |   12235 | 75.4700347210954
      9411 |    8401 | 54.6155909800435
      9411 |   12235 | 67.2581540772657
(4 rows)

13.1.6. Solution to Exercise 6

Exercise 6

 end_vid |       sum        
---------+------------------
    8401 | 91.2213922667793
   12235 | 142.728188798361
(2 rows)

13.2. Advanced Routing Queries Solutions

13.2.1. Solution to Exercise 7

Exercise 7

 seq | path_seq | node  | edge  |       cost        |     agg_cost     
-----+----------+-------+-------+-------------------+------------------
   1 |        1 | 16826 | 18065 |  15.6329128635657 |                0
   2 |        2 | 11866 | 13272 |  6.05285469974612 | 15.6329128635657
   3 |        3 | 10421 | 10002 |  1.09783108683209 | 21.6857675633119
   4 |        4 |  4882 | 14659 | 0.659568387886509 |  22.783598650144
   5 |        5 |   854 | 14618 |  6.40532835798005 | 23.4431670380305
   6 |        6 |   545 |  3090 |  1.05011295081662 | 29.8484953960105
   7 |        7 |  5404 |  5623 |  2.91881356432924 | 30.8986083468271
   8 |        8 |  9818 |  2037 |  5.33132172730635 | 33.8174219111564
   9 |        9 |  3510 |  9024 |  5.13996457192957 | 39.1487436384627
  10 |       10 |  3186 | 14799 | 0.286520832836953 | 44.2887082103923
  11 |       11 |  1721 |  2938 |  3.21772467143045 | 44.5752290432292
  12 |       12 |  5124 | 14318 |  12.8270920764088 | 47.7929537146597
  13 |       13 | 12224 |  3860 |  4.93374705447028 | 60.6200457910685
  14 |       14 |  6755 |  7902 |   2.9897471235967 | 65.5537928455388
  15 |       15 |  1229 |  7903 |  2.53753411311212 | 68.5435399691355
  16 |       16 |  3217 |  9039 |  3.35560621079849 | 71.0810740822476
  17 |       17 |  1193 |  1657 |  3.52017057215902 | 74.4366802930461
  18 |       18 |  2838 |  7332 |  3.43519661694611 | 77.9568508652051
  19 |       19 |   279 |    -1 |                 0 | 81.3920474821512
(19 rows)

13.2.2. Solution to Exercise 8

Exercise 8

 seq | path_seq | node  | edge  |       cost        |     agg_cost     
-----+----------+-------+-------+-------------------+------------------
   1 |        1 |   279 |  4181 |  3.54307250969382 |                0
   2 |        2 |  7280 |   535 | 0.602870207308306 | 3.54307250969382
   3 |        3 |   879 |   536 |  1.64046384768822 | 4.14594271700213
   4 |        4 |  4639 |  9848 |  6.12005829700807 | 5.78640656469035
   5 |        5 | 12224 | 14318 |  12.8270920764088 | 11.9064648616984
   6 |        6 |  5124 | 13930 |  3.37967692690096 | 24.7335569381072
   7 |        7 | 11571 | 16392 | 0.183767777053558 | 28.1132338650082
   8 |        8 |  2520 |  8642 |  0.72737943164592 | 28.2970016420617
   9 |        9 |  1721 | 14799 | 0.286520832836953 | 29.0243810737077
  10 |       10 |  3186 | 15052 | 0.343625970884297 | 29.3109019065446
  11 |       11 |   696 |  7579 |  1.99728951079222 | 29.6545278774289
  12 |       12 | 11317 |   789 |  3.25250989889566 | 31.6518173882211
  13 |       13 |  1315 |  8355 | 0.470577723048482 | 34.9043272871168
  14 |       14 |  2015 |  3576 |  1.22672328517158 | 35.3749050101653
  15 |       15 |  6280 |   279 |  2.35493524372283 | 36.6016282953369
  16 |       16 |   484 | 14201 | 0.382759752180137 | 38.9565635390597
  17 |       17 | 12018 |  7490 |  5.72639049881928 | 39.3393232912398
  18 |       18 |   545 | 14618 |  6.40532835798005 | 45.0657137900591
  19 |       19 |   854 | 14659 | 0.659568387886509 | 51.4710421480391
  20 |       20 |  4882 | 10002 |  1.09783108683209 | 52.1306105359257
  21 |       21 | 10421 | 13272 |  6.05285469974612 | 53.2284416227577
  22 |       22 | 11866 | 18065 |  15.6329128635657 | 59.2812963225039
  23 |       23 | 16826 |    -1 |                 0 | 74.9142091860696
(23 rows)

13.2.3. Solution to Exercise 9

Exercise 9

 seq | path_seq | node  | edge  |        cost         |      agg_cost      
-----+----------+-------+-------+---------------------+--------------------
   1 |        1 |   279 |  4181 |  0.0984186808248284 |                  0
   2 |        2 |  7280 |   535 |  0.0167463946474529 | 0.0984186808248284
   3 |        3 |   879 |   536 |  0.0455684402135617 |  0.115165075472281
   4 |        4 |  4639 |  9848 |   0.170001619361335 |  0.160733515685843
   5 |        5 | 12224 | 14318 |   0.356308113233578 |  0.330735135047178
   6 |        6 |  5124 | 13930 |  0.0938799146361379 |  0.687043248280756
   7 |        7 | 11571 | 16392 | 0.00510466047370995 |  0.780923162916894
   8 |        8 |  2520 |  8642 |  0.0202049842123867 |  0.786027823390604
   9 |        9 |  1721 | 14799 | 0.00795891202324869 |  0.806232807602991
  10 |       10 |  3186 | 15052 | 0.00954516585789715 |  0.814191719626239
  11 |       11 |   696 |  7579 |  0.0554802641886728 |  0.823736885484137
  12 |       12 | 11317 |   789 |   0.090347497191546 |  0.879217149672809
  13 |       13 |  1315 |  8355 |  0.0130716034180134 |  0.969564646864355
  14 |       14 |  2015 |  3576 |  0.0340756468103216 |  0.982636250282369
  15 |       15 |  6280 |   279 |  0.0654148678811896 |   1.01671189709269
  16 |       16 |   484 | 14201 |  0.0106322153383371 |   1.08212676497388
  17 |       17 | 12018 |  7490 |    0.15906640274498 |   1.09275898031222
  18 |       18 |   545 | 14618 |   0.177925787721668 |    1.2518253830572
  19 |       19 |   854 | 14659 |  0.0183213441079586 |   1.42975117077887
  20 |       20 |  4882 | 10002 |   0.030495307967558 |   1.44807251488682
  21 |       21 | 10421 | 13272 |   0.168134852770726 |   1.47856782285438
  22 |       22 | 11866 | 18065 |   0.434247579543493 |   1.64670267562511
  23 |       23 | 16826 |    -1 |                   0 |    2.0809502551686
(23 rows)

13.2.4. Solution to Exercise 10

Exercise 10

ALTER TABLE
UPDATE 36
 seq | path_seq | node  | edge  |       cost        |     agg_cost     
-----+----------+-------+-------+-------------------+------------------
   1 |        1 | 16826 | 18065 |  15.6329128635657 |                0
   2 |        2 | 11866 | 13272 |  6.05285469974612 | 15.6329128635657
   3 |        3 | 10421 | 10002 |  1.09783108683209 | 21.6857675633119
   4 |        4 |  4882 | 14659 | 0.659568387886509 |  22.783598650144
   5 |        5 |   854 | 14618 |  6.40532835798005 | 23.4431670380305
   6 |        6 |   545 |  3090 |  1.05011295081662 | 29.8484953960105
   7 |        7 |  5404 |  5623 |  2.91881356432924 | 30.8986083468271
   8 |        8 |  9818 |  2037 |  5.33132172730635 | 33.8174219111564
   9 |        9 |  3510 |  9024 |  5.13996457192957 | 39.1487436384627
  10 |       10 |  3186 | 14799 | 0.286520832836953 | 44.2887082103923
  11 |       11 |  1721 |  2938 |  3.21772467143045 | 44.5752290432292
  12 |       12 |  5124 | 14318 |  12.8270920764088 | 47.7929537146597
  13 |       13 | 12224 |  3860 |  4.93374705447028 | 60.6200457910685
  14 |       14 |  6755 |  7902 |   2.9897471235967 | 65.5537928455388
  15 |       15 |  1229 |  7903 |  2.53753411311212 | 68.5435399691355
  16 |       16 |  3217 |  9039 |  3.35560621079849 | 71.0810740822476
  17 |       17 |  1193 |  1657 |  3.52017057215902 | 74.4366802930461
  18 |       18 |  2838 |  7332 |  3.43519661694611 | 77.9568508652051
  19 |       19 |   279 |    -1 |                 0 | 81.3920474821512
(19 rows)

13.2.5. Solution to Exercise 11

Exercise 11

 seq | path_seq | node  | edge  |       cost        |     agg_cost     
-----+----------+-------+-------+-------------------+------------------
   1 |        1 | 16826 | 18065 |  15.6329128635657 |                0
   2 |        2 | 11866 | 13272 |  6.05285469974612 | 15.6329128635657
   3 |        3 | 10421 | 10002 |  1.09783108683209 | 21.6857675633119
   4 |        4 |  4882 | 14659 | 0.329784193943254 |  22.783598650144
   5 |        5 |   854 | 14618 |  3.20266417899002 | 23.1133828440872
   6 |        6 |   545 |  1627 | 0.705500760177701 | 26.3160470230772
   7 |        7 |  2796 |  2179 | 0.186075976259171 | 27.0215477832549
   8 |        8 |  3715 |  3152 |  1.04917082940749 | 27.2076237595141
   9 |        9 |  5515 |  4350 |  1.23652028243591 | 28.2567945889216
  10 |       10 |  7568 |  3550 | 0.318465807365421 | 29.4933148713575
  11 |       11 |  6232 |  3551 |  0.54248220916351 | 29.8117806787229
  12 |       12 |  9343 | 12618 | 0.394499808608249 | 30.3542628878864
  13 |       13 |  4568 | 15267 | 0.226417372677504 | 30.7487626964947
  14 |       14 |  8632 | 15920 | 0.838490615386183 | 30.9751800691722
  15 |       15 |  5391 |  3078 |   1.2071060491905 | 31.8136706845584
  16 |       16 |  7993 | 11827 |  3.95552020916625 | 33.0207767337489
  17 |       17 |   501 |  8227 |  1.20274124978368 | 36.9762969429151
  18 |       18 |  1767 | 10118 |  1.14525933224996 | 38.1790381926988
  19 |       19 |  5078 |  8990 |  0.39407703347385 | 39.3242975249488
  20 |       20 |  3131 |  9235 | 0.164173134978359 | 39.7183745584226
  21 |       21 |  3571 | 13696 | 0.725999632642018 |  39.882547693401
  22 |       22 | 11189 | 16557 | 0.195429397101017 |  40.608547326043
  23 |       23 | 12514 | 15002 |  1.71694049214619 |  40.803976723144
  24 |       24 |  2884 | 19347 | 0.223428912663912 | 42.5209172152902
  25 |       25 | 13632 | 16931 | 0.306158424594283 | 42.7443461279541
  26 |       26 |  8751 | 16046 | 0.322143318599456 | 43.0505045525484
  27 |       27 |  9410 | 16069 | 0.146163417769425 | 43.3726478711478
  28 |       28 |  9587 | 15536 | 0.795617219713195 | 43.5188112889173
  29 |       29 |  6290 |  1644 |  1.40330966562967 | 44.3144285086305
  30 |       30 |  2817 |  1895 | 0.256135992353668 | 45.7177381742601
  31 |       31 |  3254 |   247 | 0.760407556054191 | 45.9738741666138
  32 |       32 |   436 |  3181 | 0.793307114896991 |  46.734281722668
  33 |       33 |  5561 | 11056 | 0.331695708619089 |  47.527588837565
  34 |       34 |  6675 |  6854 |  1.09310724639851 | 47.8592845461841
  35 |       35 | 12021 |  1656 | 0.506358876637808 | 48.9523917925826
  36 |       36 |  2838 |  7332 |  1.03055898508383 | 49.4587506692204
  37 |       37 |   279 |    -1 |                 0 | 50.4893096543042
(37 rows)

13.3. Solutions to Writing a SQL Stored Procedures Chapter

13.3.1. Solution to Chapter 7 Exercise 1

Exercise 1

CREATE VIEW
 count 
-------
 23177
(1 row)

 count 
-------
 19171
(1 row)

13.3.2. Solution to Chapter 7 Exercise 2

Exercise 2

CREATE VIEW
 count 
-------
  3570
(1 row)

13.3.3. Solution to Chapter 7 Exercise 3

Exercise 3

 seq | path_seq | node  | edge  |        cost         |     agg_cost      
-----+----------+-------+-------+---------------------+-------------------
   1 |        1 | 16826 | 18065 |   0.260548547726096 |                 0
   2 |        2 | 11866 | 13272 |   0.100880911666676 | 0.260548547726096
   3 |        3 | 10421 | 10002 |  0.0182971847822312 | 0.361429459392772
   4 |        4 |  4882 | 14659 |  0.0109928064656229 | 0.379726644175003
   5 |        5 |   854 | 14618 |   0.106755472632153 | 0.390719450640626
   6 |        6 |   545 |  1627 |   0.039194486676539 | 0.497474923272779
   7 |        7 |  2796 |  2179 |  0.0103375542359144 | 0.536669409949318
   8 |        8 |  3715 |  3152 |  0.0582872683004149 | 0.547006964185232
   9 |        9 |  5515 |  4350 |  0.0686955712464395 | 0.605294232485647
  10 |       10 |  7568 |  3550 |  0.0176925448536345 | 0.673989803732087
  11 |       11 |  6232 |  3551 |  0.0180827403054503 | 0.691682348585721
  12 |       12 |  9343 | 12618 |  0.0131499936202747 | 0.709765088891171
  13 |       13 |  4568 | 15267 | 0.00754724575591681 | 0.722915082511446
  14 |       14 |  8632 | 15920 |  0.0279496871795393 | 0.730462328267363
  15 |       15 |  5391 |  3078 |  0.0402368683063498 | 0.758412015446902
  16 |       16 |  7993 |  5078 |  0.0807694761338516 | 0.798648883753252
  17 |       17 |  8845 | 10599 |  0.0717709616247938 | 0.879418359887103
  18 |       18 |  5890 | 10750 |   0.118263316641752 | 0.951189321511897
  19 |       19 |  6129 |  5821 |  0.0131947280385623 |  1.06945263815365
  20 |       20 | 10177 |    69 |  0.0122406719549513 |  1.08264736619221
  21 |       21 |    85 |    70 |  0.0721861894497039 |  1.09488803814716
  22 |       22 |  8063 | 11872 |  0.0482852460115031 |  1.16707422759687
  23 |       23 |  4557 |  9804 |   0.014534146173953 |  1.21535947360837
  24 |       24 |  2817 |  1895 |  0.0142297773534049 |  1.22989361978232
  25 |       25 |  3254 |   247 |  0.0422448642248112 |  1.24412339713573
  26 |       26 |   436 |  3181 |  0.0440726174942764 |  1.28636826136054
  27 |       27 |  5561 | 11056 |  0.0184275393677263 |  1.33044087885481
  28 |       28 |  6675 |  6854 |  0.0607281803554729 |  1.34886841822254
  29 |       29 | 12021 |  1656 |  0.0281310487025279 |  1.40959659857801
  30 |       30 |  2838 |  7332 |  0.0572532769499502 |  1.43772764728054
  31 |       31 |   279 |    -1 |                   0 |  1.49498092423049
(31 rows)

13.3.4. Solution to Chapter 7 Exercise 4

Exercise 4

 seq | path_seq | node  | edge  |        cost         |     agg_cost      |             name             
-----+----------+-------+-------+---------------------+-------------------+------------------------------
   1 |        1 | 16826 | 18065 |   0.260548547726096 |                 0 | 
   2 |        2 | 11866 | 13272 |   0.100880911666676 | 0.260548547726096 | 
   3 |        3 | 10421 | 10002 |  0.0182971847822312 | 0.361429459392772 | 
   4 |        4 |  4882 | 14659 |  0.0109928064656229 | 0.379726644175003 | Strada Batiștei
   5 |        5 |   854 | 14618 |   0.106755472632153 | 0.390719450640626 | Strada Batiștei
   6 |        6 |   545 |  1627 |   0.039194486676539 | 0.497474923272779 | Bulevardul Nicolae Bălcescu
   7 |        7 |  2796 |  2179 |  0.0103375542359144 | 0.536669409949318 | Bulevardul Nicolae Bălcescu
   8 |        8 |  3715 |  3152 |  0.0582872683004149 | 0.547006964185232 | Bulevardul Nicolae Bălcescu
   9 |        9 |  5515 |  4350 |  0.0686955712464395 | 0.605294232485647 | Bulevardul Nicolae Bălcescu
  10 |       10 |  7568 |  3550 |  0.0176925448536345 | 0.673989803732087 | Bulevardul Nicolae Bălcescu
  11 |       11 |  6232 |  3551 |  0.0180827403054503 | 0.691682348585721 | Strada Demetru Ion Dobrescu
  12 |       12 |  9343 | 12618 |  0.0131499936202747 | 0.709765088891171 | Strada Demetru Ion Dobrescu
  13 |       13 |  4568 | 15267 | 0.00754724575591681 | 0.722915082511446 | Strada Demetru Ion Dobrescu
  14 |       14 |  8632 | 15920 |  0.0279496871795393 | 0.730462328267363 | Strada Demetru Ion Dobrescu
  15 |       15 |  5391 |  3078 |  0.0402368683063498 | 0.758412015446902 | Strada Demetru Ion Dobrescu
  16 |       16 |  7993 |  5078 |  0.0807694761338516 | 0.798648883753252 | Intrarea Jean Georgescu
  17 |       17 |  8845 | 10599 |  0.0717709616247938 | 0.879418359887103 | Intrarea Jean Georgescu
  18 |       18 |  5890 | 10750 |   0.118263316641752 | 0.951189321511897 | Intrarea Cristian Popișteanu
  19 |       19 |  6129 |  5821 |  0.0131947280385623 |  1.06945263815365 | 
  20 |       20 | 10177 |    69 |  0.0122406719549513 |  1.08264736619221 | Strada Academiei
  21 |       21 |    85 |    70 |  0.0721861894497039 |  1.09488803814716 | Strada Academiei
  22 |       22 |  8063 | 11872 |  0.0482852460115031 |  1.16707422759687 | Strada Ion Câmpineanu
  23 |       23 |  4557 |  9804 |   0.014534146173953 |  1.21535947360837 | Strada Ion Câmpineanu
  24 |       24 |  2817 |  1895 |  0.0142297773534049 |  1.22989361978232 | Calea Victoriei
  25 |       25 |  3254 |   247 |  0.0422448642248112 |  1.24412339713573 | Calea Victoriei
  26 |       26 |   436 |  3181 |  0.0440726174942764 |  1.28636826136054 | Calea Victoriei
  27 |       27 |  5561 | 11056 |  0.0184275393677263 |  1.33044087885481 | Calea Victoriei
  28 |       28 |  6675 |  6854 |  0.0607281803554729 |  1.34886841822254 | Calea Victoriei
  29 |       29 | 12021 |  1656 |  0.0281310487025279 |  1.40959659857801 | Calea Victoriei
  30 |       30 |  2838 |  7332 |  0.0572532769499502 |  1.43772764728054 | Calea Victoriei
  31 |       31 |   279 |    -1 |                   0 |  1.49498092423049 | 
(31 rows)

13.3.5. Solution to Chapter 7 Exercise 5

Exercise 5

 seq | path_seq | node  | edge  |        cost         |     agg_cost      |             name             |                                                         st_astext                                                         
-----+----------+-------+-------+---------------------+-------------------+------------------------------+---------------------------------------------------------------------------------------------------------------------------
   1 |        1 | 16826 | 18065 |   0.260548547726096 |                 0 |                              | LINESTRING(26.1031652 44.4373788,26.1031254 44.4374698,26.1030738 44.4375551,26.1029835 44.4375941,26.1028076 44.4376091)
   2 |        2 | 11866 | 13272 |   0.100880911666676 | 0.260548547726096 |                              | LINESTRING(26.1028076 44.4376091,26.1027159 44.4377454)
   3 |        3 | 10421 | 10002 |  0.0182971847822312 | 0.361429459392772 |                              | LINESTRING(26.1027159 44.4377454,26.1026277 44.4378672)
   4 |        4 |  4882 | 14659 |  0.0109928064656229 | 0.379726644175003 | Strada Batiștei              | LINESTRING(26.1026277 44.4378672,26.1025297 44.437824)
   5 |        5 |   854 | 14618 |   0.106755472632153 | 0.390719450640626 | Strada Batiștei              | LINESTRING(26.1025297 44.437824,26.102313 44.4377199,26.1015087 44.4375089)
   6 |        6 |   545 |  1627 |   0.039194486676539 | 0.497474923272779 | Bulevardul Nicolae Bălcescu  | LINESTRING(26.1015087 44.4375089,26.1014616 44.43761,26.1013545 44.4378226,26.1013449 44.4378415)
   7 |        7 |  2796 |  2179 |  0.0103375542359144 | 0.536669409949318 | Bulevardul Nicolae Bălcescu  | LINESTRING(26.1013449 44.4378415,26.1013008 44.437929)
   8 |        8 |  3715 |  3152 |  0.0582872683004149 | 0.547006964185232 | Bulevardul Nicolae Bălcescu  | LINESTRING(26.1013008 44.437929,26.1010523 44.4384224)
   9 |        9 |  5515 |  4350 |  0.0686955712464395 | 0.605294232485647 | Bulevardul Nicolae Bălcescu  | LINESTRING(26.1010523 44.4384224,26.1007594 44.4390039)
  10 |       10 |  7568 |  3550 |  0.0176925448536345 | 0.673989803732087 | Bulevardul Nicolae Bălcescu  | LINESTRING(26.1007594 44.4390039,26.1006676 44.4391489)
  11 |       11 |  6232 |  3551 |  0.0180827403054503 | 0.691682348585721 | Strada Demetru Ion Dobrescu  | LINESTRING(26.1004837 44.4391168,26.1006676 44.4391489)
  12 |       12 |  9343 | 12618 |  0.0131499936202747 | 0.709765088891171 | Strada Demetru Ion Dobrescu  | LINESTRING(26.1003472 44.4391041,26.1004837 44.4391168)
  13 |       13 |  4568 | 15267 | 0.00754724575591681 | 0.722915082511446 | Strada Demetru Ion Dobrescu  | LINESTRING(26.1002682 44.4391041,26.1003472 44.4391041)
  14 |       14 |  8632 | 15920 |  0.0279496871795393 | 0.730462328267363 | Strada Demetru Ion Dobrescu  | LINESTRING(26.0999773 44.4391264,26.1002682 44.4391041)
  15 |       15 |  5391 |  3078 |  0.0402368683063498 | 0.758412015446902 | Strada Demetru Ion Dobrescu  | LINESTRING(26.099559 44.4391616,26.0999773 44.4391264)
  16 |       16 |  7993 |  5078 |  0.0807694761338516 | 0.798648883753252 | Intrarea Jean Georgescu      | LINESTRING(26.099559 44.4391616,26.0995423 44.438556)
  17 |       17 |  8845 | 10599 |  0.0717709616247938 | 0.879418359887103 | Intrarea Jean Georgescu      | LINESTRING(26.0995423 44.438556,26.0995337 44.4380178)
  18 |       18 |  5890 | 10750 |   0.118263316641752 | 0.951189321511897 | Intrarea Cristian Popișteanu | LINESTRING(26.0995337 44.4380178,26.0983257 44.4378241)
  19 |       19 |  6129 |  5821 |  0.0131947280385623 |  1.06945263815365 |                              | LINESTRING(26.0983257 44.4378241,26.0982132 44.4378815)
  20 |       20 | 10177 |    69 |  0.0122406719549513 |  1.08264736619221 | Strada Academiei             | LINESTRING(26.0982132 44.4378815,26.0980898 44.4378568)
  21 |       21 |    85 |    70 |  0.0721861894497039 |  1.09488803814716 | Strada Academiei             | LINESTRING(26.0982584 44.4373291,26.0980898 44.4378568)
  22 |       22 |  8063 | 11872 |  0.0482852460115031 |  1.16707422759687 | Strada Ion Câmpineanu        | LINESTRING(26.0977632 44.4372567,26.0982584 44.4373291)
  23 |       23 |  4557 |  9804 |   0.014534146173953 |  1.21535947360837 | Strada Ion Câmpineanu        | LINESTRING(26.0976156 44.4372303,26.0977632 44.4372567)
  24 |       24 |  2817 |  1895 |  0.0142297773534049 |  1.22989361978232 | Calea Victoriei              | LINESTRING(26.0976156 44.4372303,26.0976451 44.4371257)
  25 |       25 |  3254 |   247 |  0.0422448642248112 |  1.24412339713573 | Calea Victoriei              | LINESTRING(26.0976451 44.4371257,26.0977632 44.4368204)
  26 |       26 |   436 |  3181 |  0.0440726174942764 |  1.28636826136054 | Calea Victoriei              | LINESTRING(26.0977632 44.4368204,26.0978113 44.4367071,26.0978342 44.4366493,26.0978552 44.4365901,26.0978751 44.4365003)
  27 |       27 |  5561 | 11056 |  0.0184275393677263 |  1.33044087885481 | Calea Victoriei              | LINESTRING(26.0978751 44.4365003,26.0978827 44.4364411,26.0978864 44.4363624)
  28 |       28 |  6675 |  6854 |  0.0607281803554729 |  1.34886841822254 | Calea Victoriei              | LINESTRING(26.0978864 44.4363624,26.0978717 44.4359071)
  29 |       29 | 12021 |  1656 |  0.0281310487025279 |  1.40959659857801 | Calea Victoriei              | LINESTRING(26.0978717 44.4359071,26.0978653 44.4358042,26.0978758 44.4356965)
  30 |       30 |  2838 |  7332 |  0.0572532769499502 |  1.43772764728054 | Calea Victoriei              | LINESTRING(26.0978758 44.4356965,26.0979996 44.4352764)
  31 |       31 |   279 |    -1 |                   0 |  1.49498092423049 |                              | 
(31 rows)

13.3.6. Solution to Chapter 7 Exercise 6

Exercise 6

 seq | path_seq | node  | edge  |        cost         |     agg_cost      |             name             |                                                                                         route_geom                                                                                         
-----+----------+-------+-------+---------------------+-------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   1 |        1 | 16826 | 18065 |   0.260548547726096 |                 0 |                              | 0102000020E610000005000000D615D808691A3A405BFB4C07FC3746400D631C6D661A3A406CFEA902FF3746400F13680B631A3A40585936CE0138464012876C205D1A3A4016365E1503384640BEC74F99511A3A404C77329303384640
   2 |        2 | 11866 | 13272 |   0.100880911666676 | 0.260548547726096 |                              | 0102000020E610000002000000BEC74F99511A3A404C773293033846407A47D7964B1A3A40BA7C900A08384640
   3 |        3 | 10421 | 10002 |  0.0182971847822312 | 0.361429459392772 |                              | 0102000020E6100000020000007A47D7964B1A3A40BA7C900A08384640E82917CF451A3A40DCFE4B080C384640
   4 |        4 |  4882 | 14659 |  0.0109928064656229 | 0.379726644175003 | Strada Batiștei              | 0102000020E610000002000000E82917CF451A3A40DCFE4B080C384640635EEC623F1A3A40B3B3E89D0A384640
   5 |        5 |   854 | 14618 |   0.106755472632153 | 0.390719450640626 | Strada Batiștei              | 0102000020E610000003000000635EEC623F1A3A40B3B3E89D0A384640A5F44C2F311A3A4079A7A734073846406DC26279FC193A40BE9AA84A00384640
   6 |        6 |   545 |  1627 |   0.039194486676539 | 0.497474923272779 | Bulevardul Nicolae Bălcescu  | 0102000020E6100000040000006DC26279FC193A40BE9AA84A00384640C2CC2D63F9193A408733BF9A033846406CCD565EF2193A408F392A920A384640CC1D47BDF1193A4071AAB5300B384640
   7 |        7 |  2796 |  2179 |  0.0103375542359144 | 0.536669409949318 | Bulevardul Nicolae Bălcescu  | 0102000020E610000002000000CC1D47BDF1193A4071AAB5300B384640030F67D9EE193A40287CB60E0E384640
   8 |        8 |  3715 |  3152 |  0.0582872683004149 | 0.547006964185232 | Bulevardul Nicolae Bălcescu  | 0102000020E610000002000000030F67D9EE193A40287CB60E0E38464082AF4390DE193A40BBEAA6391E384640
   9 |        9 |  5515 |  4350 |  0.0686955712464395 | 0.605294232485647 | Bulevardul Nicolae Bălcescu  | 0102000020E61000000200000082AF4390DE193A40BBEAA6391E384640BCC3375ECB193A4082A8A04731384640
  10 |       10 |  7568 |  3550 |  0.0176925448536345 | 0.673989803732087 | Bulevardul Nicolae Bălcescu  | 0102000020E610000002000000BCC3375ECB193A4082A8A047313846404EC4115AC5193A4085C9F90736384640
  11 |       11 |  6232 |  3551 |  0.0180827403054503 | 0.691682348585721 | Strada Demetru Ion Dobrescu  | 0102000020E610000002000000F547BD4CB9193A40E58FB3FA343846404EC4115AC5193A4085C9F90736384640
  12 |       12 |  9343 | 12618 |  0.0131499936202747 | 0.709765088891171 | Strada Demetru Ion Dobrescu  | 0102000020E610000002000000C43EA65AB0193A400F852A9034384640F547BD4CB9193A40E58FB3FA34384640
  13 |       13 |  4568 | 15267 | 0.00754724575591681 | 0.722915082511446 | Strada Demetru Ion Dobrescu  | 0102000020E6100000020000002BD43F2DAB193A400F852A9034384640C43EA65AB0193A400F852A9034384640
  14 |       14 |  8632 | 15920 |  0.0279496871795393 | 0.730462328267363 | Strada Demetru Ion Dobrescu  | 0102000020E610000002000000A6D7C11C98193A40B5673B4B353846402BD43F2DAB193A400F852A9034384640
  15 |       15 |  5391 |  3078 |  0.0402368683063498 | 0.758412015446902 | Strada Demetru Ion Dobrescu  | 0102000020E610000002000000C005D9B27C193A405BD4827236384640A6D7C11C98193A40B5673B4B35384640
  16 |       16 |  7993 |  5078 |  0.0807694761338516 | 0.798648883753252 | Intrarea Jean Georgescu      | 0102000020E610000002000000C005D9B27C193A405BD48272363846409111AB9A7B193A4077BB5E9A22384640
  17 |       17 |  8845 | 10599 |  0.0717709616247938 | 0.879418359887103 | Intrarea Jean Georgescu      | 0102000020E6100000020000009111AB9A7B193A4077BB5E9A223846409159620A7B193A406E089FF710384640
  18 |       18 |  5890 | 10750 |   0.118263316641752 | 0.951189321511897 | Intrarea Cristian Popișteanu | 0102000020E6100000020000009159620A7B193A406E089FF71038464037DB81DF2B193A404873BF9E0A384640
  19 |       19 |  6129 |  5821 |  0.0131947280385623 |  1.06945263815365 |                              | 0102000020E61000000200000037DB81DF2B193A404873BF9E0A3846401709128024193A40000341800C384640
  20 |       20 | 10177 |    69 |  0.0122406719549513 |  1.08264736619221 | Strada Academiei             | 0102000020E6100000020000001709128024193A40000341800C3846403912C3691C193A40652A0EB10B384640
  21 |       21 |    85 |    70 |  0.0721861894497039 |  1.09488803814716 | Strada Academiei             | 0102000020E610000002000000AA8E667627193A40680B6366FA3746403912C3691C193A40652A0EB10B384640
  22 |       22 |  8063 | 11872 |  0.0482852460115031 |  1.16707422759687 | Strada Ion Câmpineanu        | 0102000020E61000000200000097C0520207193A407B3A0D07F8374640AA8E667627193A40680B6366FA374640
  23 |       23 |  4557 |  9804 |   0.014534146173953 |  1.21535947360837 | Strada Ion Câmpineanu        | 0102000020E61000000200000055940156FD183A40FFA89729F737464097C0520207193A407B3A0D07F8374640
  24 |       24 |  2817 |  1895 |  0.0142297773534049 |  1.22989361978232 | Calea Victoriei              | 0102000020E61000000200000055940156FD183A40FFA89729F73746405A1DEF44FF183A40DDDE24BCF3374640
  25 |       25 |  3254 |   247 |  0.0422448642248112 |  1.24412339713573 | Calea Victoriei              | 0102000020E6100000020000005A1DEF44FF183A40DDDE24BCF337464097C0520207193A40E21C1ABBE9374640
  26 |       26 |   436 |  3181 |  0.0440726174942764 |  1.28636826136054 | Calea Victoriei              | 0102000020E61000000500000097C0520207193A40E21C1ABBE9374640E3AD4E290A193A402B37AC04E63746402A6E81A90B193A4020A9CF1FE437464059BED3090D193A40F1A0342FE2374640BD97B1570E193A40DB98E83DDF374640
  27 |       27 |  5561 | 11056 |  0.0184275393677263 |  1.33044087885481 | Calea Victoriei              | 0102000020E610000003000000BD97B1570E193A40DB98E83DDF3746401C5833D70E193A40AD904D4DDD37464022B946150F193A401F9A1EB9DA374640
  28 |       28 |  6675 |  6854 |  0.0607281803554729 |  1.34886841822254 | Calea Victoriei              | 0102000020E61000000200000022B946150F193A401F9A1EB9DA37464034B4A61E0E193A400F4CC9CDCB374640
  29 |       29 | 12021 |  1656 |  0.0281310487025279 |  1.40959659857801 | Calea Victoriei              | 0102000020E61000000300000034B4A61E0E193A400F4CC9CDCB374640C9E946B30D193A40CF3A996EC8374640E11170630E193A40A73D25E7C4374640
  30 |       30 |  2838 |  7332 |  0.0572532769499502 |  1.43772764728054 | Calea Victoriei              | 0102000020E610000002000000E11170630E193A40A73D25E7C43746406605758016193A403D5C1723B7374640
  31 |       31 |   279 |    -1 |                   0 |  1.49498092423049 |                              | 
(31 rows)

13.3.7. Solution to Chapter 7 Exercise 7

Exercise 7

 seq |             name             |        cost         |     azimuth      |                                                         st_astext                                                         |                                                                                         route_geom                                                                                         
-----+------------------------------+---------------------+------------------+---------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   1 |                              |   0.260548547726096 | 302.782169450011 | LINESTRING(26.1031652 44.4373788,26.1031254 44.4374698,26.1030738 44.4375551,26.1029835 44.4375941,26.1028076 44.4376091) | 0102000020E610000005000000D615D808691A3A405BFB4C07FC3746400D631C6D661A3A406CFEA902FF3746400F13680B631A3A40585936CE0138464012876C205D1A3A4016365E1503384640BEC74F99511A3A404C77329303384640
   2 |                              |   0.100880911666676 | 326.068097933036 | LINESTRING(26.1028076 44.4376091,26.1027159 44.4377454)                                                                   | 0102000020E610000002000000BEC74F99511A3A404C773293033846407A47D7964B1A3A40BA7C900A08384640
   3 |                              |  0.0182971847822312 |   324.0902769212 | LINESTRING(26.1027159 44.4377454,26.1026277 44.4378672)                                                                   | 0102000020E6100000020000007A47D7964B1A3A40BA7C900A08384640E82917CF451A3A40DCFE4B080C384640
   4 | Strada Batiștei              |  0.0109928064656229 | 246.211331589752 | LINESTRING(26.1026277 44.4378672,26.1025297 44.437824)                                                                    | 0102000020E610000002000000E82917CF451A3A40DCFE4B080C384640635EEC623F1A3A40B3B3E89D0A384640
   5 | Strada Batiștei              |   0.106755472632153 | 252.848780112053 | LINESTRING(26.1025297 44.437824,26.102313 44.4377199,26.1015087 44.4375089)                                               | 0102000020E610000003000000635EEC623F1A3A40B3B3E89D0A384640A5F44C2F311A3A4079A7A734073846406DC26279FC193A40BE9AA84A00384640
   6 | Bulevardul Nicolae Bălcescu  |   0.039194486676539 | 333.780516282454 | LINESTRING(26.1015087 44.4375089,26.1014616 44.43761,26.1013545 44.4378226,26.1013449 44.4378415)                         | 0102000020E6100000040000006DC26279FC193A40BE9AA84A00384640C2CC2D63F9193A408733BF9A033846406CCD565EF2193A408F392A920A384640CC1D47BDF1193A4071AAB5300B384640
   7 | Bulevardul Nicolae Bălcescu  |  0.0103375542359144 | 333.251895836797 | LINESTRING(26.1013449 44.4378415,26.1013008 44.437929)                                                                    | 0102000020E610000002000000CC1D47BDF1193A4071AAB5300B384640030F67D9EE193A40287CB60E0E384640
   8 | Bulevardul Nicolae Bălcescu  |  0.0582872683004149 | 333.267973819051 | LINESTRING(26.1013008 44.437929,26.1010523 44.4384224)                                                                    | 0102000020E610000002000000030F67D9EE193A40287CB60E0E38464082AF4390DE193A40BBEAA6391E384640
   9 | Bulevardul Nicolae Bălcescu  |  0.0686955712464395 | 333.265726256021 | LINESTRING(26.1010523 44.4384224,26.1007594 44.4390039)                                                                   | 0102000020E61000000200000082AF4390DE193A40BBEAA6391E384640BCC3375ECB193A4082A8A04731384640
  10 | Bulevardul Nicolae Bălcescu  |  0.0176925448536345 | 327.661958189901 | LINESTRING(26.1007594 44.4390039,26.1006676 44.4391489)                                                                   | 0102000020E610000002000000BCC3375ECB193A4082A8A047313846404EC4115AC5193A4085C9F90736384640
  11 | Strada Demetru Ion Dobrescu  |  0.0180827403054503 | 80.0986962617441 | LINESTRING(26.1004837 44.4391168,26.1006676 44.4391489)                                                                   | 0102000020E610000002000000F547BD4CB9193A40E58FB3FA343846404EC4115AC5193A4085C9F90736384640
  12 | Strada Demetru Ion Dobrescu  |  0.0131499936202747 | 84.6844865453176 | LINESTRING(26.1003472 44.4391041,26.1004837 44.4391168)                                                                   | 0102000020E610000002000000C43EA65AB0193A400F852A9034384640F547BD4CB9193A40E58FB3FA34384640
  13 | Strada Demetru Ion Dobrescu  | 0.00754724575591681 |               90 | LINESTRING(26.1002682 44.4391041,26.1003472 44.4391041)                                                                   | 0102000020E6100000020000002BD43F2DAB193A400F852A9034384640C43EA65AB0193A400F852A9034384640
  14 | Strada Demetru Ion Dobrescu  |  0.0279496871795393 | 94.3836433729028 | LINESTRING(26.0999773 44.4391264,26.1002682 44.4391041)                                                                   | 0102000020E610000002000000A6D7C11C98193A40B5673B4B353846402BD43F2DAB193A400F852A9034384640
  15 | Strada Demetru Ion Dobrescu  |  0.0402368683063498 | 94.8101148734388 | LINESTRING(26.099559 44.4391616,26.0999773 44.4391264)                                                                    | 0102000020E610000002000000C005D9B27C193A405BD4827236384640A6D7C11C98193A40B5673B4B35384640
  16 | Intrarea Jean Georgescu      |  0.0807694761338516 | 181.579585685047 | LINESTRING(26.099559 44.4391616,26.0995423 44.438556)                                                                     | 0102000020E610000002000000C005D9B27C193A405BD48272363846409111AB9A7B193A4077BB5E9A22384640
  17 | Intrarea Jean Georgescu      |  0.0717709616247938 | 180.915462229908 | LINESTRING(26.0995423 44.438556,26.0995337 44.4380178)                                                                    | 0102000020E6100000020000009111AB9A7B193A4077BB5E9A223846409159620A7B193A406E089FF710384640
  18 | Intrarea Cristian Popișteanu |   0.118263316641752 | 260.890300656502 | LINESTRING(26.0995337 44.4380178,26.0983257 44.4378241)                                                                   | 0102000020E6100000020000009159620A7B193A406E089FF71038464037DB81DF2B193A404873BF9E0A384640
  19 |                              |  0.0131947280385623 | 297.031684957325 | LINESTRING(26.0983257 44.4378241,26.0982132 44.4378815)                                                                   | 0102000020E61000000200000037DB81DF2B193A404873BF9E0A3846401709128024193A40000341800C384640
  20 | Strada Academiei             |  0.0122406719549513 | 258.681138775484 | LINESTRING(26.0982132 44.4378815,26.0980898 44.4378568)                                                                   | 0102000020E6100000020000001709128024193A40000341800C3846403912C3691C193A40652A0EB10B384640
  21 | Strada Academiei             |  0.0721861894497039 | 342.281333761022 | LINESTRING(26.0982584 44.4373291,26.0980898 44.4378568)                                                                   | 0102000020E610000002000000AA8E667627193A40680B6366FA3746403912C3691C193A40652A0EB10B384640
  22 | Strada Ion Câmpineanu        |  0.0482852460115031 | 81.6820857711606 | LINESTRING(26.0977632 44.4372567,26.0982584 44.4373291)                                                                   | 0102000020E61000000200000097C0520207193A407B3A0D07F8374640AA8E667627193A40680B6366FA374640
  23 | Strada Ion Câmpineanu        |   0.014534146173953 | 79.8592068553213 | LINESTRING(26.0976156 44.4372303,26.0977632 44.4372567)                                                                   | 0102000020E61000000200000055940156FD183A40FFA89729F737464097C0520207193A407B3A0D07F8374640
  24 | Calea Victoriei              |  0.0142297773534049 | 164.250127360143 | LINESTRING(26.0976156 44.4372303,26.0976451 44.4371257)                                                                   | 0102000020E61000000200000055940156FD183A40FFA89729F73746405A1DEF44FF183A40DDDE24BCF3374640
  25 | Calea Victoriei              |  0.0422448642248112 | 158.851903758982 | LINESTRING(26.0976451 44.4371257,26.0977632 44.4368204)                                                                   | 0102000020E6100000020000005A1DEF44FF183A40DDDE24BCF337464097C0520207193A40E21C1ABBE9374640
  26 | Calea Victoriei              |  0.0440726174942764 |  160.73148365408 | LINESTRING(26.0977632 44.4368204,26.0978113 44.4367071,26.0978342 44.4366493,26.0978552 44.4365901,26.0978751 44.4365003) | 0102000020E61000000500000097C0520207193A40E21C1ABBE9374640E3AD4E290A193A402B37AC04E63746402A6E81A90B193A4020A9CF1FE437464059BED3090D193A40F1A0342FE2374640BD97B1570E193A40DB98E83DDF374640
  27 | Calea Victoriei              |  0.0184275393677263 | 175.315453326785 | LINESTRING(26.0978751 44.4365003,26.0978827 44.4364411,26.0978864 44.4363624)                                             | 0102000020E610000003000000BD97B1570E193A40DB98E83DDF3746401C5833D70E193A40AD904D4DDD37464022B946150F193A401F9A1EB9DA374640
  28 | Calea Victoriei              |  0.0607281803554729 | 181.849232342157 | LINESTRING(26.0978864 44.4363624,26.0978717 44.4359071)                                                                   | 0102000020E61000000200000022B946150F193A401F9A1EB9DA37464034B4A61E0E193A400F4CC9CDCB374640
  29 | Calea Victoriei              |  0.0281310487025279 | 178.884695988895 | LINESTRING(26.0978717 44.4359071,26.0978653 44.4358042,26.0978758 44.4356965)                                             | 0102000020E61000000300000034B4A61E0E193A400F4CC9CDCB374640C9E946B30D193A40CF3A996EC8374640E11170630E193A40A73D25E7C4374640
  30 | Calea Victoriei              |  0.0572532769499502 | 163.580190144522 | LINESTRING(26.0978758 44.4356965,26.0979996 44.4352764)                                                                   | 0102000020E610000002000000E11170630E193A40A73D25E7C43746406605758016193A403D5C1723B7374640
(30 rows)

13.3.8. Solution to Chapter 7 Exercise 8

Exercise 8

 seq |             name             |        cost         |     azimuth      |                                                         st_astext                                                         |                                                                                         route_geom                                                                                         
-----+------------------------------+---------------------+------------------+---------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   1 |                              |   0.260548547726096 | 302.782169450011 | LINESTRING(26.1031652 44.4373788,26.1031254 44.4374698,26.1030738 44.4375551,26.1029835 44.4375941,26.1028076 44.4376091) | 0102000020E610000005000000D615D808691A3A405BFB4C07FC3746400D631C6D661A3A406CFEA902FF3746400F13680B631A3A40585936CE0138464012876C205D1A3A4016365E1503384640BEC74F99511A3A404C77329303384640
   2 |                              |   0.100880911666676 | 326.068097933036 | LINESTRING(26.1028076 44.4376091,26.1027159 44.4377454)                                                                   | 0102000020E610000002000000BEC74F99511A3A404C773293033846407A47D7964B1A3A40BA7C900A08384640
   3 |                              |  0.0182971847822312 |   324.0902769212 | LINESTRING(26.1027159 44.4377454,26.1026277 44.4378672)                                                                   | 0102000020E6100000020000007A47D7964B1A3A40BA7C900A08384640E82917CF451A3A40DCFE4B080C384640
   4 | Strada Batiștei              |  0.0109928064656229 | 246.211331589752 | LINESTRING(26.1026277 44.4378672,26.1025297 44.437824)                                                                    | 0102000020E610000002000000E82917CF451A3A40DCFE4B080C384640635EEC623F1A3A40B3B3E89D0A384640
   5 | Strada Batiștei              |   0.106755472632153 | 252.848780112053 | LINESTRING(26.1025297 44.437824,26.102313 44.4377199,26.1015087 44.4375089)                                               | 0102000020E610000003000000635EEC623F1A3A40B3B3E89D0A384640A5F44C2F311A3A4079A7A734073846406DC26279FC193A40BE9AA84A00384640
   6 | Bulevardul Nicolae Bălcescu  |   0.039194486676539 | 333.780516282454 | LINESTRING(26.1015087 44.4375089,26.1014616 44.43761,26.1013545 44.4378226,26.1013449 44.4378415)                         | 0102000020E6100000040000006DC26279FC193A40BE9AA84A00384640C2CC2D63F9193A408733BF9A033846406CCD565EF2193A408F392A920A384640CC1D47BDF1193A4071AAB5300B384640
   7 | Bulevardul Nicolae Bălcescu  |  0.0103375542359144 | 333.251895836797 | LINESTRING(26.1013449 44.4378415,26.1013008 44.437929)                                                                    | 0102000020E610000002000000CC1D47BDF1193A4071AAB5300B384640030F67D9EE193A40287CB60E0E384640
   8 | Bulevardul Nicolae Bălcescu  |  0.0582872683004149 | 333.267973819051 | LINESTRING(26.1013008 44.437929,26.1010523 44.4384224)                                                                    | 0102000020E610000002000000030F67D9EE193A40287CB60E0E38464082AF4390DE193A40BBEAA6391E384640
   9 | Bulevardul Nicolae Bălcescu  |  0.0686955712464395 | 333.265726256021 | LINESTRING(26.1010523 44.4384224,26.1007594 44.4390039)                                                                   | 0102000020E61000000200000082AF4390DE193A40BBEAA6391E384640BCC3375ECB193A4082A8A04731384640
  10 | Bulevardul Nicolae Bălcescu  |  0.0176925448536345 | 327.661958189901 | LINESTRING(26.1007594 44.4390039,26.1006676 44.4391489)                                                                   | 0102000020E610000002000000BCC3375ECB193A4082A8A047313846404EC4115AC5193A4085C9F90736384640
  11 | Strada Demetru Ion Dobrescu  |  0.0180827403054503 | 260.098696261744 | LINESTRING(26.1006676 44.4391489,26.1004837 44.4391168)                                                                   | 0102000020E6100000020000004EC4115AC5193A4085C9F90736384640F547BD4CB9193A40E58FB3FA34384640
  12 | Strada Demetru Ion Dobrescu  |  0.0131499936202747 | 264.684486545318 | LINESTRING(26.1004837 44.4391168,26.1003472 44.4391041)                                                                   | 0102000020E610000002000000F547BD4CB9193A40E58FB3FA34384640C43EA65AB0193A400F852A9034384640
  13 | Strada Demetru Ion Dobrescu  | 0.00754724575591681 |              270 | LINESTRING(26.1003472 44.4391041,26.1002682 44.4391041)                                                                   | 0102000020E610000002000000C43EA65AB0193A400F852A90343846402BD43F2DAB193A400F852A9034384640
  14 | Strada Demetru Ion Dobrescu  |  0.0279496871795393 | 274.383643372903 | LINESTRING(26.1002682 44.4391041,26.0999773 44.4391264)                                                                   | 0102000020E6100000020000002BD43F2DAB193A400F852A9034384640A6D7C11C98193A40B5673B4B35384640
  15 | Strada Demetru Ion Dobrescu  |  0.0402368683063498 | 274.810114873439 | LINESTRING(26.0999773 44.4391264,26.099559 44.4391616)                                                                    | 0102000020E610000002000000A6D7C11C98193A40B5673B4B35384640C005D9B27C193A405BD4827236384640
  16 | Intrarea Jean Georgescu      |  0.0807694761338516 | 181.579585685047 | LINESTRING(26.099559 44.4391616,26.0995423 44.438556)                                                                     | 0102000020E610000002000000C005D9B27C193A405BD48272363846409111AB9A7B193A4077BB5E9A22384640
  17 | Intrarea Jean Georgescu      |  0.0717709616247938 | 180.915462229908 | LINESTRING(26.0995423 44.438556,26.0995337 44.4380178)                                                                    | 0102000020E6100000020000009111AB9A7B193A4077BB5E9A223846409159620A7B193A406E089FF710384640
  18 | Intrarea Cristian Popișteanu |   0.118263316641752 | 260.890300656502 | LINESTRING(26.0995337 44.4380178,26.0983257 44.4378241)                                                                   | 0102000020E6100000020000009159620A7B193A406E089FF71038464037DB81DF2B193A404873BF9E0A384640
  19 |                              |  0.0131947280385623 | 297.031684957325 | LINESTRING(26.0983257 44.4378241,26.0982132 44.4378815)                                                                   | 0102000020E61000000200000037DB81DF2B193A404873BF9E0A3846401709128024193A40000341800C384640
  20 | Strada Academiei             |  0.0122406719549513 | 258.681138775484 | LINESTRING(26.0982132 44.4378815,26.0980898 44.4378568)                                                                   | 0102000020E6100000020000001709128024193A40000341800C3846403912C3691C193A40652A0EB10B384640
  21 | Strada Academiei             |  0.0721861894497039 | 162.281333761022 | LINESTRING(26.0980898 44.4378568,26.0982584 44.4373291)                                                                   | 0102000020E6100000020000003912C3691C193A40652A0EB10B384640AA8E667627193A40680B6366FA374640
  22 | Strada Ion Câmpineanu        |  0.0482852460115031 | 261.682085771161 | LINESTRING(26.0982584 44.4373291,26.0977632 44.4372567)                                                                   | 0102000020E610000002000000AA8E667627193A40680B6366FA37464097C0520207193A407B3A0D07F8374640
  23 | Strada Ion Câmpineanu        |   0.014534146173953 | 259.859206855321 | LINESTRING(26.0977632 44.4372567,26.0976156 44.4372303)                                                                   | 0102000020E61000000200000097C0520207193A407B3A0D07F837464055940156FD183A40FFA89729F7374640
  24 | Calea Victoriei              |  0.0142297773534049 | 164.250127360143 | LINESTRING(26.0976156 44.4372303,26.0976451 44.4371257)                                                                   | 0102000020E61000000200000055940156FD183A40FFA89729F73746405A1DEF44FF183A40DDDE24BCF3374640
  25 | Calea Victoriei              |  0.0422448642248112 | 158.851903758982 | LINESTRING(26.0976451 44.4371257,26.0977632 44.4368204)                                                                   | 0102000020E6100000020000005A1DEF44FF183A40DDDE24BCF337464097C0520207193A40E21C1ABBE9374640
  26 | Calea Victoriei              |  0.0440726174942764 |  160.73148365408 | LINESTRING(26.0977632 44.4368204,26.0978113 44.4367071,26.0978342 44.4366493,26.0978552 44.4365901,26.0978751 44.4365003) | 0102000020E61000000500000097C0520207193A40E21C1ABBE9374640E3AD4E290A193A402B37AC04E63746402A6E81A90B193A4020A9CF1FE437464059BED3090D193A40F1A0342FE2374640BD97B1570E193A40DB98E83DDF374640
  27 | Calea Victoriei              |  0.0184275393677263 | 175.315453326785 | LINESTRING(26.0978751 44.4365003,26.0978827 44.4364411,26.0978864 44.4363624)                                             | 0102000020E610000003000000BD97B1570E193A40DB98E83DDF3746401C5833D70E193A40AD904D4DDD37464022B946150F193A401F9A1EB9DA374640
  28 | Calea Victoriei              |  0.0607281803554729 | 181.849232342157 | LINESTRING(26.0978864 44.4363624,26.0978717 44.4359071)                                                                   | 0102000020E61000000200000022B946150F193A401F9A1EB9DA37464034B4A61E0E193A400F4CC9CDCB374640
  29 | Calea Victoriei              |  0.0281310487025279 | 178.884695988895 | LINESTRING(26.0978717 44.4359071,26.0978653 44.4358042,26.0978758 44.4356965)                                             | 0102000020E61000000300000034B4A61E0E193A400F4CC9CDCB374640C9E946B30D193A40CF3A996EC8374640E11170630E193A40A73D25E7C4374640
  30 | Calea Victoriei              |  0.0572532769499502 | 163.580190144522 | LINESTRING(26.0978758 44.4356965,26.0979996 44.4352764)                                                                   | 0102000020E610000002000000E11170630E193A40A73D25E7C43746406605758016193A403D5C1723B7374640
(30 rows)

13.3.9. Solution to Chapter 7 Exercise 9

Exercise 9

CREATE FUNCTION

13.3.10. Solution to Chapter 7 Exercise 10

Exercise 10

 seq |  gid  |             name             |        cost         |     azimuth      |                                                      route_readable                                                       |                                                                                         route_geom                                                                                         
-----+-------+------------------------------+---------------------+------------------+---------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   1 | 18065 |                              |   0.260548547726096 | 302.782169450011 | LINESTRING(26.1031652 44.4373788,26.1031254 44.4374698,26.1030738 44.4375551,26.1029835 44.4375941,26.1028076 44.4376091) | 0102000020E610000005000000D615D808691A3A405BFB4C07FC3746400D631C6D661A3A406CFEA902FF3746400F13680B631A3A40585936CE0138464012876C205D1A3A4016365E1503384640BEC74F99511A3A404C77329303384640
   2 | 13272 |                              |   0.100880911666676 | 326.068097933036 | LINESTRING(26.1028076 44.4376091,26.1027159 44.4377454)                                                                   | 0102000020E610000002000000BEC74F99511A3A404C773293033846407A47D7964B1A3A40BA7C900A08384640
   3 | 10002 |                              |  0.0182971847822312 |   324.0902769212 | LINESTRING(26.1027159 44.4377454,26.1026277 44.4378672)                                                                   | 0102000020E6100000020000007A47D7964B1A3A40BA7C900A08384640E82917CF451A3A40DCFE4B080C384640
   4 | 14659 | Strada Batiștei              |  0.0109928064656229 | 246.211331589752 | LINESTRING(26.1026277 44.4378672,26.1025297 44.437824)                                                                    | 0102000020E610000002000000E82917CF451A3A40DCFE4B080C384640635EEC623F1A3A40B3B3E89D0A384640
   5 | 14618 | Strada Batiștei              |   0.106755472632153 | 252.848780112053 | LINESTRING(26.1025297 44.437824,26.102313 44.4377199,26.1015087 44.4375089)                                               | 0102000020E610000003000000635EEC623F1A3A40B3B3E89D0A384640A5F44C2F311A3A4079A7A734073846406DC26279FC193A40BE9AA84A00384640
   6 |  1627 | Bulevardul Nicolae Bălcescu  |   0.039194486676539 | 333.780516282454 | LINESTRING(26.1015087 44.4375089,26.1014616 44.43761,26.1013545 44.4378226,26.1013449 44.4378415)                         | 0102000020E6100000040000006DC26279FC193A40BE9AA84A00384640C2CC2D63F9193A408733BF9A033846406CCD565EF2193A408F392A920A384640CC1D47BDF1193A4071AAB5300B384640
   7 |  2179 | Bulevardul Nicolae Bălcescu  |  0.0103375542359144 | 333.251895836797 | LINESTRING(26.1013449 44.4378415,26.1013008 44.437929)                                                                    | 0102000020E610000002000000CC1D47BDF1193A4071AAB5300B384640030F67D9EE193A40287CB60E0E384640
   8 |  3152 | Bulevardul Nicolae Bălcescu  |  0.0582872683004149 | 333.267973819051 | LINESTRING(26.1013008 44.437929,26.1010523 44.4384224)                                                                    | 0102000020E610000002000000030F67D9EE193A40287CB60E0E38464082AF4390DE193A40BBEAA6391E384640
   9 |  4350 | Bulevardul Nicolae Bălcescu  |  0.0686955712464395 | 333.265726256021 | LINESTRING(26.1010523 44.4384224,26.1007594 44.4390039)                                                                   | 0102000020E61000000200000082AF4390DE193A40BBEAA6391E384640BCC3375ECB193A4082A8A04731384640
  10 |  3550 | Bulevardul Nicolae Bălcescu  |  0.0176925448536345 | 327.661958189901 | LINESTRING(26.1007594 44.4390039,26.1006676 44.4391489)                                                                   | 0102000020E610000002000000BCC3375ECB193A4082A8A047313846404EC4115AC5193A4085C9F90736384640
  11 |  3551 | Strada Demetru Ion Dobrescu  |  0.0180827403054503 | 260.098696261744 | LINESTRING(26.1006676 44.4391489,26.1004837 44.4391168)                                                                   | 0102000020E6100000020000004EC4115AC5193A4085C9F90736384640F547BD4CB9193A40E58FB3FA34384640
  12 | 12618 | Strada Demetru Ion Dobrescu  |  0.0131499936202747 | 264.684486545318 | LINESTRING(26.1004837 44.4391168,26.1003472 44.4391041)                                                                   | 0102000020E610000002000000F547BD4CB9193A40E58FB3FA34384640C43EA65AB0193A400F852A9034384640
  13 | 15267 | Strada Demetru Ion Dobrescu  | 0.00754724575591681 |              270 | LINESTRING(26.1003472 44.4391041,26.1002682 44.4391041)                                                                   | 0102000020E610000002000000C43EA65AB0193A400F852A90343846402BD43F2DAB193A400F852A9034384640
  14 | 15920 | Strada Demetru Ion Dobrescu  |  0.0279496871795393 | 274.383643372903 | LINESTRING(26.1002682 44.4391041,26.0999773 44.4391264)                                                                   | 0102000020E6100000020000002BD43F2DAB193A400F852A9034384640A6D7C11C98193A40B5673B4B35384640
  15 |  3078 | Strada Demetru Ion Dobrescu  |  0.0402368683063498 | 274.810114873439 | LINESTRING(26.0999773 44.4391264,26.099559 44.4391616)                                                                    | 0102000020E610000002000000A6D7C11C98193A40B5673B4B35384640C005D9B27C193A405BD4827236384640
  16 |  5078 | Intrarea Jean Georgescu      |  0.0807694761338516 | 181.579585685047 | LINESTRING(26.099559 44.4391616,26.0995423 44.438556)                                                                     | 0102000020E610000002000000C005D9B27C193A405BD48272363846409111AB9A7B193A4077BB5E9A22384640
  17 | 10599 | Intrarea Jean Georgescu      |  0.0717709616247938 | 180.915462229908 | LINESTRING(26.0995423 44.438556,26.0995337 44.4380178)                                                                    | 0102000020E6100000020000009111AB9A7B193A4077BB5E9A223846409159620A7B193A406E089FF710384640
  18 | 10750 | Intrarea Cristian Popișteanu |   0.118263316641752 | 260.890300656502 | LINESTRING(26.0995337 44.4380178,26.0983257 44.4378241)                                                                   | 0102000020E6100000020000009159620A7B193A406E089FF71038464037DB81DF2B193A404873BF9E0A384640
  19 |  5821 |                              |  0.0131947280385623 | 297.031684957325 | LINESTRING(26.0983257 44.4378241,26.0982132 44.4378815)                                                                   | 0102000020E61000000200000037DB81DF2B193A404873BF9E0A3846401709128024193A40000341800C384640
  20 |    69 | Strada Academiei             |  0.0122406719549513 | 258.681138775484 | LINESTRING(26.0982132 44.4378815,26.0980898 44.4378568)                                                                   | 0102000020E6100000020000001709128024193A40000341800C3846403912C3691C193A40652A0EB10B384640
  21 |    70 | Strada Academiei             |  0.0721861894497039 | 162.281333761022 | LINESTRING(26.0980898 44.4378568,26.0982584 44.4373291)                                                                   | 0102000020E6100000020000003912C3691C193A40652A0EB10B384640AA8E667627193A40680B6366FA374640
  22 | 11872 | Strada Ion Câmpineanu        |  0.0482852460115031 | 261.682085771161 | LINESTRING(26.0982584 44.4373291,26.0977632 44.4372567)                                                                   | 0102000020E610000002000000AA8E667627193A40680B6366FA37464097C0520207193A407B3A0D07F8374640
  23 |  9804 | Strada Ion Câmpineanu        |   0.014534146173953 | 259.859206855321 | LINESTRING(26.0977632 44.4372567,26.0976156 44.4372303)                                                                   | 0102000020E61000000200000097C0520207193A407B3A0D07F837464055940156FD183A40FFA89729F7374640
  24 |  1895 | Calea Victoriei              |  0.0142297773534049 | 164.250127360143 | LINESTRING(26.0976156 44.4372303,26.0976451 44.4371257)                                                                   | 0102000020E61000000200000055940156FD183A40FFA89729F73746405A1DEF44FF183A40DDDE24BCF3374640
  25 |   247 | Calea Victoriei              |  0.0422448642248112 | 158.851903758982 | LINESTRING(26.0976451 44.4371257,26.0977632 44.4368204)                                                                   | 0102000020E6100000020000005A1DEF44FF183A40DDDE24BCF337464097C0520207193A40E21C1ABBE9374640
  26 |  3181 | Calea Victoriei              |  0.0440726174942764 |  160.73148365408 | LINESTRING(26.0977632 44.4368204,26.0978113 44.4367071,26.0978342 44.4366493,26.0978552 44.4365901,26.0978751 44.4365003) | 0102000020E61000000500000097C0520207193A40E21C1ABBE9374640E3AD4E290A193A402B37AC04E63746402A6E81A90B193A4020A9CF1FE437464059BED3090D193A40F1A0342FE2374640BD97B1570E193A40DB98E83DDF374640
  27 | 11056 | Calea Victoriei              |  0.0184275393677263 | 175.315453326785 | LINESTRING(26.0978751 44.4365003,26.0978827 44.4364411,26.0978864 44.4363624)                                             | 0102000020E610000003000000BD97B1570E193A40DB98E83DDF3746401C5833D70E193A40AD904D4DDD37464022B946150F193A401F9A1EB9DA374640
  28 |  6854 | Calea Victoriei              |  0.0607281803554729 | 181.849232342157 | LINESTRING(26.0978864 44.4363624,26.0978717 44.4359071)                                                                   | 0102000020E61000000200000022B946150F193A401F9A1EB9DA37464034B4A61E0E193A400F4CC9CDCB374640
  29 |  1656 | Calea Victoriei              |  0.0281310487025279 | 178.884695988895 | LINESTRING(26.0978717 44.4359071,26.0978653 44.4358042,26.0978758 44.4356965)                                             | 0102000020E61000000300000034B4A61E0E193A400F4CC9CDCB374640C9E946B30D193A40CF3A996EC8374640E11170630E193A40A73D25E7C4374640
  30 |  7332 | Calea Victoriei              |  0.0572532769499502 | 163.580190144522 | LINESTRING(26.0978758 44.4356965,26.0979996 44.4352764)                                                                   | 0102000020E610000002000000E11170630E193A40A73D25E7C43746406605758016193A403D5C1723B7374640
(30 rows)

13.4. Solutions to Writing a pl/pgsql Stored Procedures Chapter

13.4.1. Solution to Chapter 8 Exercise 1

Exercise 1: Number of Vertices

 count 
-------
 17050
(1 row)

 count 
-------
 14773
(1 row)

 count 
-------
  2904
(1 row)

13.4.2. Solution to Chapter 8 Exercise 2

Exercise 2: Nearest Vertex

   osm_id   
------------
 3096105995
(1 row)

  osm_id   
-----------
 100815543
(1 row)

  osm_id   
-----------
 254451696
(1 row)

13.4.3. Solution to Chapter 8 Exercise 3

Exercise 3: Creating the function

CREATE FUNCTION

13.4.4. Solution to Chapter 8 Exercise 4

Exercise 4: Using the function

 seq | gid | name | length | the_time | azimuth | geom 
-----+-----+------+--------+----------+---------+------
(0 rows)

 seq | gid | name | length | the_time | azimuth | geom 
-----+-----+------+--------+----------+---------+------
(0 rows)

SELECT 0