Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A cycle in an undirected graph G that goes through all the vertices of G is call

ID: 3651498 • Letter: A

Question

A cycle in an undirected graph G that goes through all the vertices of G is called a spanning
cycle. Assume that H is an undirected graph that has a spanning cycle and we construct
another undirected graph H? from H by adding a single vertex at a time together with some
edges between the new vertex and some of the old vertices. More precisely, we have a sequence
of graphs H = H0,H1,H2,

Explanation / Answer

We want to run Dijkstra algorithm whose edge weights are integers in the range 0,1,...,W where W is a relatively small number. a)Using a bucket implementation (also known as Dial’s implementation) Dijkstra algorithm can be made to run in O(W|V | + |E|). Idea is to ?nd an upper bound on shortest distance labels. Since the maximum edge weight is W and a vertex can be updated at most |V |-1 times, we get a bound of O(W|V |) on shortest path distances. Using the property of Dijkstra algorithm that the distance labels that are designated permanent are non-decreasing we can present the following algorithm procedure Efficient-Dijkstra1(G,l,W,s) Input: Graph G=(V, E), edge weights le, Max edge weight W, vertex s ? V Output: Shortest path distance labels for all vertices v ? V : dist(v) = 8 prev(v) = nil bucket(v) = nil Create an array B of size W|V |: B[i] keep vertex of distance label i B[0] = s,dist(s)=0,bucket(s)=0 index = 0 while index =6 W|V | Increment index: B[index] =6 Ø u = B[index] for all edges (u,v) ? E: temp = dist(v) if dist(v) > dist(u) + l(u,v): dist(v) = dist(u)+l(u,v) prev(v) = u B[dist(v)] = v if temp =6 8: Remove v from B[temp] Doubly linked list should be used for array B, which allows us to do the following operations in O(1) time: (1) Checking whether a bucket is empty or nonempty (2) Deleting an element from a bucket (3) Adding an element to the bucket (b)The algorithm is same as the algorithm shown on Page 110. We claim the following lemma

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote