Question

a. (15 marks) i (7 marks) Consider the weighted directed graph below. Carry out the steps of Dijkstras shortest path algoritgraph G with weights w from s to t also produce Dijkstras shortest path algorithm the same shortest path Xs? If so, explain

a. (15 marks) i (7 marks) Consider the weighted directed graph below. Carry out the steps of Dijkstra's shortest path algorithm as covered in lectures, starting at vertex S. Consequently give the shortest path from S to vertex T and its length 6 A 2 3 4 S T F ii (2 marks) For a graph G = (V, E), what is the worst-case time complexity of the version of Dijkstra's shortest path algorithm examined in lectures? (Your answer should be in terms of |V| and/or |E|.) iii (6 marks) Repeat the above trace of Dijkstra's algorithm on the given graph, but where the weights are double those in the graph above. b. (6 marks) Consider an arbitrary weighted directed graph G = (V, E) with weights w : E -> R (that is, the weights are real numbers). Assume that when you run Dijkstra's shortest path algorithm on G from some vertex s E V to another vertex t E V, you get shortest path Xs-t Now, consider the same graph G = (V,E) with weights that are double the original weights (i.e. with weights u' : E -> R such that w'(e) = 2w(e) for any e € E: this is the general case of the specific instance in (a(iii)) above). Will running Dijkstra's shortest path algorithm on graph G with weights w' from s to t also produce the same shortest path X? If so, explain why (in no more than 5 lines). If not, give a counter-example. c. (6 marks) Consider an arbitrary weighted directed graph G = (V, E) with weights w : E -»R (that is, the weights are real numbers). Assume that when you run Dijkstra's shortest path algorithm on G from some vertex s E V to another vertex t E V, you get shortest path Xst Now, consider the same graph G = (V, E) with weights that are the original weights plus 2 (i.e. with weights u' : E -> R such that w'(e) = w(e) +2 for any e E E). Will running Page 11
graph G with weights w' from s to t also produce Dijkstra's shortest path algorithm the same shortest path Xs? If so, explain why (in no more than 5 lines). If not, give a counter-example. on
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Question A:
part I.
Shortest path's length from S to T is 8. There two roads with sum of 8: S->A->D->T and S->F->T.
part II.  If we sue adjacenty list to represent graph than worst time for Dijskstra is O(E + VlogV). If we use matrix to represent graph than it is O(V^2 +ElogV).
part III. Distance will be length of 16. Ands there will be same roads as in first part of question.
Question B:
multiplying each node by same number will not change shortest path. Each path's length in graph will became A*B where A is the prevous length and B is the number we use to multiply edges.
Questions C:
No, roads will not be same, because adding 2 to each edge affects roads differently. For example if one road had 2 edges it will be increased by 4, while another road with 3 edges will be increased by 6. So the shortest path might not stay same,


Comment down for any queries

Please give a thumb up

Add a comment
Know the answer?
Add Answer to:
a. (15 marks) i (7 marks) Consider the weighted directed graph below. Carry out the steps...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Consider the problem of finding the shortest paths in a weighted directed graph using Dijkstra's algorithm.

    Consider the problem of finding the shortest paths in a weighted directed graph using Dijkstra's algorithm. Denote the set of vertices as V, the number of vertices as |V|, the set of edges as E, and the number of edges as |E|. Answer the following questions.Below is a pseudo-code of the algorithm that computes the length c[v] of the shortest path from the start node s to each node v. Answer code to fill in the blank _______ .

  • 5. (10 pts) Give a concrete example of a directed and weighted graph G and two...

    5. (10 pts) Give a concrete example of a directed and weighted graph G and two vertices u and v, where the Dijkstra's algorithm does not find the shortest path from u to v in G but the Bellman-Ford algorithm does. Obviously such a graph must have at least one negative- weight edge.

  • Consider the following weighted, directed graph G. There are 7 vertices and 10 edges. The edge list E is as follows:

    Consider the following weighted, directed graph G. There are 7 vertices and 10 edges. The edge list E is as follows:The Bellman-Ford algorithm makes |V|-1 = 7-1 = 6 passes through the edge list E. Each pass relaxes the edges in the order they appear in the edge list. As with Dijkstra's algorithm, we record the current best known cost D[V] to reach each vertex V from the start vertex S. Initially D[A]=0 and D[V]=+oo for all the other vertices...

  • 5. Here are the vertices and edges of directed graph G: V= {2.6.c.de.f} E= {ab, ac,...

    5. Here are the vertices and edges of directed graph G: V= {2.6.c.de.f} E= {ab, ac, af ca. bc. be.bf. cd, ce, de, df). Weights: w(ab) = 2 w(ac) = 5, w(af) = 10, w(ca) = 2. w(be) = 2. w(be) = 10, w(bf) = 11. w(cd)= 9. w(ce) = 7. w(de) = 2. w(df) = 2. a. Draw the Graph. This is a directed, weighted graph so you need to include arrows and weights. You can insert a pic...

  • 10) Shortest Paths (10 marks) Some pseudocode for the shortest path problem is given below. When DIJKSTRA (G, w,s) is called, G is a given graph, w contains the weights for edges in G, and s is a sta...

    10) Shortest Paths (10 marks) Some pseudocode for the shortest path problem is given below. When DIJKSTRA (G, w,s) is called, G is a given graph, w contains the weights for edges in G, and s is a starting vertex DIJKSTRA (G, w, s) INITIALIZE-SINGLE-SOURCE(G, s) 1: RELAX (u, v, w) 1: if dlv] > dlu (u, v) then 2d[v] <- d[u] +w(u, v) 3 4: end if 4: while Q φ do 5: uExTRACT-MIN Q) for each vertex v...

  • Let G = (V, E, w) be a connected weighted undirected graph. Given a vertex s...

    Let G = (V, E, w) be a connected weighted undirected graph. Given a vertex s ∈ V and a shortest path tree Ts with respect to the source s, design a linear time algorithm for checking whether the shortest path tree Ts is correct or not.(C pseudo)

  • Shortest paths Consider a directed graph with vertices fa, b, c, d, e, f and adjacency...

    Shortest paths Consider a directed graph with vertices fa, b, c, d, e, f and adjacency list representation belovw (with edge weights in parentheses): a: b(4), f(2) e: a(6), b(3), d(7) d: a(6), e(2) e: d(5) f: d(2), e(3) (i) Find three shortest paths from c to e. (ii) Which of these paths could have been found by Dijkstra's shortest path algorithm? (Give a convincing explanation by referring to the main steps of the algorithm.)

  • 10. You are given a directed graph G(V, E) where every vertex vi E V is...

    10. You are given a directed graph G(V, E) where every vertex vi E V is associated with a weight wi> 0. The length of a path is the sum of weights of all vertices along this path. Given s,t e V, suggest an O((n+ m) log n) time algorithm for finding the shortest path m s toO As usual, n = IVI and m = IEI.

  • Given a directed graph with positive edge lengths and a specified vertex v in the graph,...

    Given a directed graph with positive edge lengths and a specified vertex v in the graph, the "all-pairs" v-constrained shortest path problem" is the problem of computing for each pair of vertices i and j the shortest path from i to j that goes through the vertex v. If no such path exists, the answer is . Describe an algorithm that takes a graph G= (V; E) and vertex v as input parameters and computes values L(i; j) that represent...

  • Consider a directed acyclic graph G = (V, E) without edge lengths and a start vertex...

    Consider a directed acyclic graph G = (V, E) without edge lengths and a start vertex s E V. (Recall, the length of a path in an graph without edge lengths is given by the number of edges on that path). Someone claims that the following greedy algorithm will always find longest path in the graph G starting from s. path = [8] Ucurrent = s topologically sort the vertices V of G. forall v EV in topological order do...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT