Dijkstra's algorithm for shortest path; Prim's algorithm for minimum spanning tree