Dijkstra and Helper functions.

Signed-off-by: Erwin de Haan <git@erayan.eu>