Unformatted text preview: distance d. • Each vertex v at distance d is adjacent to some vertex w at distance d1. • Hence, when expanding from w, we will see v. • If v is visited it must have been bound by some other w’ at distance d1; else it is unvisited. • In either case we set v’s distance to d • Since no vertex at distance d is dequeued until all vertices at distance d1 have been dequeued (by IH&FIFO), all verticeis at distance d will have been enqueued by the time last vertex at distance d1 is processed. • Conclude that all verticies at dist d are enqueued before any vertex dist > d. Cost Initial: θ(n) Loop: θ(n) for enqueue, dequeue = = θ(m) Added all together gives us θ(n+m)...
View
Full Document
 Spring '11
 Cytron
 Computer Science, Algorithms, Graph Theory, Data Structures, Distance

Click to edit the document details