Northern Kentucky University**We aren't endorsed by this school
Course
CSC 699
Subject
Computer Science
Date
Jan 13, 2025
Pages
3
Uploaded by HighnessTurkey583
1 Problem 1. Run Dijkstra1 on the graph below from vertex s to every vertex in V = {a, b, c, d, e, f, g, h, s}. Write down:(a)[9 points] The minimum-weight path weight δ(s, v) for each vertexv ∈V . No explanation are required here. From the given graph and applying Dijkstra's algorithm starting from s, the shortest path weights are: δ(s,s)=0δ(s,a)=8 δ(s,b)=9 δ(s,c)=7 δ(s,d)=8 δ(s,e)=11 δ(s,h)=10 δ(s,g)=12 δ(s,f)=infinity (b)[9 points] The order that vertices are removed from Dijkstra’s pri- ority queue. No explanation is required here.s→c→a→d→b→h→e→g (c)[16 points] Change the weight of edge (g, c) to −6 . Identify a vertex v for which running Dijkstra from s as in part (a) would change the shortest path estimate to v at a time when v is not in Dijkstra’spriority queue. Briefly explain your answer.When the weight of (g,c) is changed to −6: Initially, c is reached directly from s with a path weight of 7 After g is processed, the new path s→a→d→h→g→cbecomes 8+0+2+2−6= 6, which is shorter. However, since c has already been processed and removed from the priority queue, it will not be revisited. Thus, the vertex v is c.
2 Problem 2. [30 points] In a weighted directed graph G = (V, E), the weighted eccentricity ϵ(u) of a vertex u ∈V is the shortest weighted distance to its farthest vertex v. That is,ϵ(u) = max δ(u, v), v∈V where, as usual, δ(u, v) is the distance from vertex u to vertex v.The weighted radius r(G) of a weighted directed graph G = (V, E) is the smallest eccentricity of any vertex. That is,r(G) = min ϵ(u).u∈V Given a weighted directed graph G on n vertices, where edge weights may be positive or negative but G contains no negative-weight cycle, de- scribe an O(n3)-time algorithm to determine the graph’s weighted radius. Briefly justify why your algorithm runs in O(n3).Steps in the Algorithm Input:A weighted directed graph G=(V,E) with n vertices and no negative-weight cycles. Run Floyd-Warshall:Compute all-pairs shortest paths δ(u,v) in O(n^3) Compute Eccentricities:Time complexity for this step is O(n^2) since we compute the maximum for n vertices. Determine the Radius:Time complexity for this step is O(n) The algorithm runs in O(n3)O(n^3)O(n3)-time because: 1.Floyd-Warshall Algorithm: Computes all-pairs shortest paths in O(n^3), where n is the number of vertices. This dominates the overall runtime. 2.Eccentricity Calculation: For each vertex uuu, finding the maximum δ(u,v) over n vertices requires O(n^2) time for all vertices. 3.Radius Calculation: Finding the minimum eccentricity across n vertices takes O(n). Thus, the total time complexity is O(n^3), and this bound is achieved because the most time-intensive step is the Floyd-Warshall algorithm.