Question: 1. Let G = (V, E) be a directed graph with edge weights w : E R (which may be positive, negative, or zero), and

1. Let G = (V, E) be a directed graph with edge weights w : E R (which may be positive, negative, or zero), and let s be an arbitrary vertex of G.

(a) Suppose every vertex v stores a number dis t(v). Describe and analyze an algorithm that returns yes if dis t(v) is the shortest-path distance from s to v for every vertex v. Otherwise, the algorithm should return no. Your algorithm should be asymptotically faster than one that computes shortest path distances from scratch.

(b) Suppose instead that every vertex v 6= s stores a pointer pred(v) to another vertex in G. Describe and analyze an algorithm that returns yes if these predecessor pointers define a single-source shortest path tree rooted at s. Otherwise, your algorithm should return no. Your algorithm should be asymptotically faster than one that computes shortest path distances from scratch. The running time for both parts should be in terms of V and E, the number of vertices and edges in the input graph.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!