Dijkstra implementation in C.