BFS Algorithm for st-distance Initialize:dist(s)=0;dist(u)=oo for all other u, Q=[s] While 0 is not empty Dequeue the top element u of Q (Enqueue all neighbors v of u that haven't been covered so far into Q,with dist function adjusted) For all neighbors v of u,if dist(v)=oo, enqueue(v) dist(v)=dist(u)+l(u,v). Is this correct? If t is found,then stop and output dist(t) 25BFS Algorithm for 𝑠𝑡-distance ◼ Initialize: 𝑑𝑖𝑠𝑡(𝑠) = 0; 𝑑𝑖𝑠𝑡(𝑢) = ∞ for all other 𝑢, ◼ 𝑄 = [𝑠] ◼ While 𝑄 is not empty ❑ Dequeue the top element 𝑢 of 𝑄 ❑ (Enqueue all neighbors 𝑣 of 𝑢 that haven’t been covered so far into 𝑄, with 𝑑𝑖𝑠𝑡 function adjusted) For all neighbors 𝑣 of 𝑢, if 𝑑𝑖𝑠𝑡(𝑣) = ∞, ◼ enqueue(𝑣) ◼ 𝑑𝑖𝑠𝑡(𝑣) = 𝑑𝑖𝑠𝑡(𝑢) + 1 ❑ If 𝑡 is found, then stop and output 𝑑𝑖𝑠𝑡(𝑡) 𝑙(𝑢, 𝑣). Is this correct? 25