nismod / snail

spatial networks impact assessment library 🐌
https://nismod.github.io/snail/
MIT License
9 stars 1 forks source link

Consider helper for node-based routing costs #34

Open tomalrussell opened 3 years ago

tomalrussell commented 3 years ago

Adapting note from #21

The cost of traversing a node from one edge to another may be useful for transport modelling (e.g. turn restrictions or turn penalties, waiting times at stations or ports, general costs of crossing borders).

A potential approach would be to introduce a complete graph (from each in-edge to each out-edge) at the location of nodes where waiting times are applicable, e.g. for a 2-degree node b with some waiting time 3:

    10    3    5
a - - - - b - - - - c

turns into

a - - - - b' - b'' - - - - c
     10      3        5

Where the "waiting cost" of 3 at node b gets represented by an edge of weight 3 between b' and b'' (even though b' and b'' are physically represented as in the same location as b).

For more complex intersections, use the same idea of replacing a node of degree n with a Kn complete graph..


a---b---c
    |
    d

a - b1
c - b2
d - b3
b1 - b2  # a-b - b-c
b1 - b3  # a-b - b-d
b2 - b3  # c-b - b-d