Toy implementation of Dijsktra's algorithm