wrote dijkstra's implementation. it appears to be working.