BFS(u):
Q = {u}
while Q is not empty:
v = Q.pop()
for each edge (v, w):
if w not discovered, Q.push(w)
else, ignore w
DFS(u):
for each edge (u,v):
if node v not discovered, DFS(v)
else, back to node u
return
Dijkstra(u):
Initialize distances, parents, & priority queue Q
while Q is not empty:
v = Q.extractMin()
for each edge e = (v,w):
if w.distance > v.distance + e.weight:
w.distance = v.distance + e.weight
w.parent = v
else, ignore this edge