def dijkstra(graph,source,target): # initialize "visited" nodes # ("visited" nodes keep track of how you got there and the total distance) # initialize your "to do list" of nodes # (start at the source, got here by starting here, with total distance of 0) # while there are nodes in your todo list # get the node with the highest priority, i.e., the lowest total distance # "visit" it # is this node the target? If so, you're done. # return (typically) the path from the source to here, as stored in the "visited" nodes # explore the edges from here # for each pointed-to node, recompute the total distance, and add/update them in todo list # return "I can't get there."