Question: Suppose that we order the edge relaxations in each pass of the Bellman-Ford algorithm as follows. Before the first pass, we assign an arbitrary linear
a. Prove that Gf is acyclic with topological sort ¬v1, v2,..., v |V|¬ and that G b is acyclic with topological sort ¬v |V|, v|V|-1,...,v1¬. Suppose that we implement each pass of the Bellman-Ford algorithm in the following way. We visit each vertex in the order v1, v2,..., v |V|, relaxing edges of Ef that leave the vertex. We then visit each vertex in the order v |V|, v|V|-1,..., v1, relaxing edges of Eb that leave the vertex.
b. Prove that with this scheme, if G contains no negative-weight cycles that are reachable from the source vertex s, then after only ⌈|V | /2⌉ passes over the edges, d[v] = δ(s, v) for all vertices v ¬ V.
c. Does this scheme improve the asymptotic running time of the Bellman-Ford algorithm?
Step by Step Solution
3.30 Rating (162 Votes )
There are 3 Steps involved in it
a Assume for contradiction that Gf is not acyclic thus Gf has a cycle A cycle must have at least one ... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (1 attachment)
C-S-A (145).docx
120 KBs Word File
