Implementation of A*, Dijkstra and Prim's algorithm