0% found this document useful (0 votes)
2 views2 pages

dijkstra's algo

The document outlines Dijkstra's Algorithm applied to a graph starting from Node A, detailing the initialization of node labels and the step-by-step process of finding the shortest paths to each node. It includes the graph edges, the updates to node labels during each step, and the final shortest paths and routing table from Node A. The final routing table shows the destination, next hop, and total cost for each node.

Uploaded by

Salaar Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

dijkstra's algo

The document outlines Dijkstra's Algorithm applied to a graph starting from Node A, detailing the initialization of node labels and the step-by-step process of finding the shortest paths to each node. It includes the graph edges, the updates to node labels during each step, and the final shortest paths and routing table from Node A. The final routing table shows the destination, next hop, and total cost for each node.

Uploaded by

Salaar Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Dijkstra’s Algorithm from Node A

B
G
5 7 12 1
2

2 8 8 6
A C E H I

3 4 11
2

5
D F

Given Graph Edges


• A–B: 5, A–C: 2, A–D: 3
• B–C: 2

• C–D: 2, C–E: 8
• D–E: 4, D–F: 5
• E–F: 5, E–G: 12, E–H: 8

• G–I: 1, H–I: 6

Step-by-Step Dijkstra’s Algorithm from A


Initialization: Set label of A to 0. All others to ∞.
Node Label Previous
A 0 –
B ∞ –
C ∞ –
D ∞ –
E ∞ –
F ∞ –
G ∞ –
H ∞ –
I ∞ –

1
Step 1: From A
A–B: 0 + 5 = 5
A–C: 0 + 2 = 2
A–D: 0 + 3 = 3
Step 2: From C (label 2)
C–B: 2 + 2 = 4 ⇒ Update B to 4
C–D: 2 + 2 = 4 ⇒ Keep D = 3
C–E: 2 + 8 = 10
Step 3: From D (label 3)
D–E: 3 + 4 = 7 ⇒ Update E to 7
D–F: 3 + 5 = 8
Step 4: From B (label 4) No shorter paths found.
Step 5: From E (label 7)
E–F: 7 + 5 = 12 ⇒ Keep F = 8
E–G: 7 + 12 = 19
E–H: 7 + 8 = 15
Step 6: From F (label 8) No shorter paths found.
Step 7: From H (label 15)
H–I: 15 + 6 = 21
Step 8: From G (label 19)

G–I: 19 + 1 = 20 ⇒ Update I to 20

Final Shortest Paths from A


Node Cost Path
A 0 A
B 4 A→ C→B
C 2 A→ C
D 3 A→ D
E 7 A→ D→E
F 8 A→ D→F
G 19 A→ D→E→G
H 15 A→ D→E→H
I 20 A→ D→E→G→I

Routing Table at Node A


Destination Next Hop Total Cost
A – 0
B C 4
C C 2
D D 3
E D 7
F D 8
G D 19
H D 15
I D 20

You might also like