Question

In: Computer Science

Trace through of Dijkstra’s Algorithm, using vertex v5 as the source vertex. Here is adjacency matrix...

Trace through of Dijkstra’s Algorithm, using vertex v5 as the source vertex.

Here is adjacency matrix representing the graph with n = 6 vertices:

1

2

3

4

5

6

1

0

999

5

8

999

4

2

9

0

999

999

12

3

3

999

10

0

2

9

999

4

999

999

999

0

999

999

5

999

7

17

999

0

11

6

5

999

11

16

2

0

            Initially we have: vnear = 5. Fill array performing initiation.

1

2

3

4

5

6

touch

length

             Repeat the main loop 5 times:

Hint: copy and paste following table five times, then fill all values for arrays.

            vnear =

1

2

3

4

5

6

touch

length

Solutions

Expert Solution

Step 1 Let us first discuss about Dijkstra algorithm

Step 2 Using Dijkstra algorithm

1)vnear= Intially

1 2 3 4 5 6
length 0
touch N N N N - N

2)vnear= 5

1 2 3 4 5 6
length 999 7 17 999 0 11
touch 5 5 5 5 - 5

3)vnear = 2

1 2 3 4 5 6
touch 2 5 5 5 - 2
length 16 7 17 999 0 10

4)vnear = 6

1 2 3 4 5 6
touch 6 5 5 6 - 2
length 15 7 17 26 0 10

5)vnear = 1

1 2 3 4 5 6
touch 6 5 5 1 - 2
length 15 7 17 23 0 10

6)vnear = 3

1 2 3 4 5 6
touch 6 5 5 3 _ 2
length 15 7 17 19 0 10

At the end ,node 4 will be selected finally


Related Solutions

Express the degree of a vertex in terms of the adjacency matrix Describe how you can...
Express the degree of a vertex in terms of the adjacency matrix Describe how you can find out whether a graph is connected, based on its adjacency matrix, using only matrix addition and multiplication.
How to write Prim's Algorithm with min-Heap and adjacency Lists?
How to write Prim's Algorithm with min-Heap and adjacency Lists?
One simple representation for a graph is to use an adjacency matrix: each of the N...
One simple representation for a graph is to use an adjacency matrix: each of the N nodes is given a unique number in the range 0 to N-1 to identify it. A large two dimensional array A with N rows and N columns is created so that A[x][y] stores the cost of travelling directly from node x to node y. if A[x][y] is zero, then there is no direct connection from x to y. A[x][y] does not need to equal...
Need to write a code using c# Strassen’s Algorithm for matrix multiplication.
Need to write a code using c# Strassen’s Algorithm for matrix multiplication.
Given the following adjacency matrix, A, for nodes a, b, c, and d, find the transitive...
Given the following adjacency matrix, A, for nodes a, b, c, and d, find the transitive closure of A. Is the result an equivalence relation, and why or why not? A = ⌈ 1 0 1 0 ⌉ | 0 1 1 0 | | 1 0 0 1 | ⌊ 1 1 0 0 ⌋
Use the Table button in the Rich-Text Editor to provide an adjacency matrix for a simple...
Use the Table button in the Rich-Text Editor to provide an adjacency matrix for a simple graph that meets the following requirements: 1) has 5 vertices 2) is maximal planar
maximumST is a function that should take an n × n vector (representing the adjacency matrix...
maximumST is a function that should take an n × n vector (representing the adjacency matrix of a graph) as input and return the value of the maximum spanning tree of the graph defined by the n × n vector. Code: #include <vector> #include <cmath> #include <iostream> #include <cstdio> using namespace std; double maximumST( vector< vector<double> > adjacencyMatrix ){   vector<int> row(4,-1);   vector< vector<int> > matrix(5,row);   cerr << matrix.size() << endl;   cerr << matrix[0].size() << endl;   for( int i = 0;...
AVL trees in Java For a given adjacency matrix of a rooted tree you need to...
AVL trees in Java For a given adjacency matrix of a rooted tree you need to decide whether this tree can be labeled to become an avl tree. Vertices of the tree do not have keys but numbered from 0 to n − 1 in order to write the adjacency matrix. INPUT format: The input consists of blocks. Blocks are written one after another without empty lines between them. Every block starts with a new line and consists of several...
Strassen’s algorithm for matrix multiplication relies on using 7 multiplications (instead of 8 as in the...
Strassen’s algorithm for matrix multiplication relies on using 7 multiplications (instead of 8 as in the straightforward algorithm) to multiply a pair of 2 by 2 matrices. Explain why it is not possible to further reduce this number, 7, to anything less than 4, in multiplying a pair of 2 by 2 matrices.
Strassen’s algorithm for matrix multiplication relies on using 7 multiplications (instead of 8 as in the...
Strassen’s algorithm for matrix multiplication relies on using 7 multiplications (instead of 8 as in the straightforward algorithm) to multiply a pair of 2 by 2 matrices. Explain why it is not possible to further reduce this number, 7, to anything less than 4, in multiplying a pair of 2 by 2 matrices.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT