Shortest path dijkstras algorithm, Data Structure & Algorithms

Assignment Help:

* Initialise d & pi*

for each vertex v within V( g )

g.d[v] := infinity

 g.pi[v] := nil

g.d[s] := 0;

* Set S to empty *

S := { 0 }

 Q := V(g)

* While (V-S) is not null*

while not Empty(Q)

1.   Sort the vertices within V-S according to the current best estimate of their distance from the source

 u := Extract-Min ( Q );

2.   Add vertex u, the closest vertex into V-S, to S, Add Node( S, u );

3.   Relax all of the vertices yet in V-S connected to u

relax( Node u, Node v, double w[][] )

if d[v] > d[u] + w[u]v] then

d[v] := d[u] + w[u][v]

pi[v] := u

 

In brief, this algorithm begins by assigning a weight of infinity to all of vertices, and then choosing a source & assigning a weight of zero to it. Vertices are added up to the set for which shortest paths are known. While a vertex is chosen, the weights of its adjacent vertices are relaxed. Once all of vertices are relaxed, their predecessor's vertices are updated (pi). The cycle of selection, weight relaxation & predecessor update is repeated till the shortest path to all vertices has been determined.


Related Discussions:- Shortest path dijkstras algorithm

Python programming, how to write a function of area of a circle using pytho...

how to write a function of area of a circle using python

Applications, Arrays are simple, however reliable to employ in more conditi...

Arrays are simple, however reliable to employ in more condition than you can count. Arrays are utilized in those problems while the number of items to be solved out is fixed. They

Prefix and Postfix Expressions, Q.   Draw the expression tree of the infix ...

Q.   Draw the expression tree of the infix expression written below and then  convert it intoPrefix and Postfix expressions. ((a + b) + c * (d + e) + f )* (g + h )

Last in first out method, This method is the reverse of FIFO and assumes th...

This method is the reverse of FIFO and assumes that each issue of stock is made from latest items received in the enterprises .Thus if the last lot to be received is not sufficient

Calculate address of an element in an array., Q. Explain the technique to c...

Q. Explain the technique to calculate the address of an element in an array. A  25 × 4  matrix array DATA is stored in memory in 'row-major order'. If base  address is 200 and

Red black tree, red black tree construction for 4,5,6,7,8,9

red black tree construction for 4,5,6,7,8,9

Construction of a binary tree , Q. Construct a binary tree whose nodes in i...

Q. Construct a binary tree whose nodes in inorder and preorder are written as follows: Inorder : 10, 15, 17, 18, 20, 25, 30, 35, 38, 40, 50 Preorder: 20, 15, 10

Darw a flowchart for inputs number of hours of sunshine, This algorithm inp...

This algorithm inputs number of hours of sunshine recorded every day for a week (7 days). Output is the highest value for hours of sunshine and average (mean) value for numbers of

Dataset for dmi, The following DNA sequences are extracted from promoter re...

The following DNA sequences are extracted from promoter region of genes which are co-regulated by the same transcription factor (TF). The nucleotide segments capitalized in the giv

Drawback of sequential file, Following are some of the drawback of sequenti...

Following are some of the drawback of sequential file organisation: Updates are not simply accommodated. By definition, random access is impossible. All records should be

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd