Inputs: origin, origin line , , , |
for each node n in Graph: |
-n.dist ≔ infinity; |
-n.previous ≔ undefined; |
|
Q ≔ Priority queue according to distance; |
for each origin stop s in : |
-s.dist ≔ 0; |
-enqueue s into Q; |
|
while Q.isEmpty != true: |
-u ≔ node with min distance in Q; |
-remove u from Q; |
-for each outbound edge e of node u: |
--v ≔ node reachable from u with edge e; |
--e.weight ≔ infinity; |
--if e.Line : |
---if u.previous != null: |
----prev_e ≔ edge used for reaching to u |
----if e is a line: |
-----if e.Line != prev_e.Line: |
------if e.Line ∈ : e.weight ≔ ; |
------else if e.Line ∈ : e.weight ≔ + coefficient1; |
------else e.weight ≔ + coefficient2; |
-----else e.weight ≔ ; // e.Line = prev_e.Line |
----else if e is foot-edge: e.weight ≔ ; |
---else e.weight ≔ ; // u.previous = null |
|
-for each outbound edge e of node u: |
--v ≔ node reachable from u with edge e; |
--dist_v ≔ u.dist + e.weigth; |
--if dist_v < v.dist: |
---dequeue v from Q with key v.dist; |
---v.dist ≔ dist_v; |
---v.previous ≔ u; |
---decrease-key v in Q; |
---enqueue v into Q with key dist_v; |
|
S ≔ empty sequence; |
u ≔ target; |
while u.previous is not null: |
-insert u into S; |
-u ≔ u.previous; |