I need some help, with a dijkstra algorithm in PHP.
The idea is develop a shortest path way inside a building. Entrance by a main entrance to a Hall and then 2 buildings, left (VB) and right (PS).
All names are VB-0-LIFT (building-floor-place).
https://github.com/phpmasterdotcom/DataStructuresForPHPDevs/blob/master/Graphs/graph-dijkstra.php
Array
(
[ENTRANCE] => Array
(
[VB-0-HALL-CROSS] => 1
[PS-0-HALL-CROSS] => 1
)
[VB-0-HALL-CROSS] => Array
(
[ENTRANCE] => 1
)
[PS-0-HALL-CROSS] => Array
(
[ENTRANCE] => 1
)
)
My headache begins when I start try the routes:
A ) OK. $r->route('VB-0-HALL-CROSS', 'PS-0-HALL-CROSS')
B) FAIL. $r->route('PS-0-HALL-CROSS', 'VB-0-HALL-CROSS')
C) OK. $r->route('ENTRANCE', 'PS-0-HALL-CROSS')
I don't know if I don't understand dijkstra but when I connect VB-0-HALL-CROSS and PS-0-HALL-CROSS with lift combinations, such as VB-0-HALL-CROSS -> VB lift 0 floor
And this with 12 floors.
In case of floors, only works with some, others doesn't work.
Is there any problem with final vertex in dijkstra algorithm? Or any idea of why does it goes wrong?
while (!isEnded()) echo "thank you Colleagues";
(I can attach the code in github fully commented).