Question: The graph G, given above, is converted into a weighted graph wG = , as follows: wV = {(A, (1, 23)), (B, (2, 17)), (C,
The graph G, given above, is converted into a weighted graph wG =
wV = {(A, (1, 23)), (B, (2, 17)), (C, (3, 14)), (D, (4, 6)), (J, (5, 13)), (K, (6, 10)), (P, (5, 1)), (Q, (3, 7)), (R, (2, 5)), (X, (1, 12)), (Y, (4, 13)), ( Z, (6, 19))};
wE = {((A, B), 5), ((A, K), 4), ((A, P), 3), ((B, C), 6), ((B, Q), 3), ((C, D), 2), ((C, R), 3), ((D, J), 4) ((D, X), 2), ((J, K), 2), ((J, Y), 5), ((K, Z), 6), ((P, R),3), ((P, Y), 5), ((Q, X), 4), ((Q, Z), 4), ((R, Y), 1), ((X, Z), 6)}.
2. Do the following problems:
a. Draw the weighted graph wG.
b. Draw an adjacency matrix representation of wG.
c. Draw a linked list implementation of the adjacency list representation of wG.
d. Find the least cost path from node A to all the other nodes, using Dijkstras algorithm.
e. Sort the weight values in the second position of each 2-tuple node weight, using (x1) Treesort, (x2) Quicksort, and (x3) Mergesort.
f. Use a hash table (of size 10) to store all the edge weights of wG
g. Use a heap to store the weight values in the first position of each 2-tuple node weight.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
