Ce diaporama a bien été signalé.
Le téléchargement de votre SlideShare est en cours. ×

Bellman-Ford Algorithm.pptx

Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Prochain SlideShare
BFS.pptx
BFS.pptx
Chargement dans…3
×

Consultez-les par la suite

1 sur 14 Publicité

Plus De Contenu Connexe

Plus récents (20)

Publicité

Bellman-Ford Algorithm.pptx

  1. 1. Eastern University Presentation on Bellman-Ford Algorithm  Presented TO  Tanzim Tamanna Shitu  Presented By  Ashik Ahammed Hridoy  ID: 203400003 1
  2. 2. What is Bellman-Ford?  Bellman Ford algorithm helps us find the shortest path from a vertex to all other vertices of a weighted graph.  It is similar to Dijkstra's algorithm but it can work with graphs in which edges can have negative weights. 2
  3. 3. Example of Bellman Ford : 3  Relaxation: If {d(u) + c(u , v) < d(u)} d(v) = d(u) + c (u , v)  Iteration: (n – 1) [n : no. of vertices] (6 – 1) = 5 times A D C B E F
  4. 4. Example of Bellman Ford : 4 A D C B E F 0 -1 5 6 4 -2 -2 3 3 -1 A B C D E F 0 ∞ ∞ ∞ ∞ ∞ Step - 1 1st Iteration Selected Vertices
  5. 5. Example of Bellman Ford : 5 A D C B E F 0 -1 5 6 4 -2 -2 3 3 -1 A B C D E F A 0 ∞ ∞ ∞ ∞ ∞ 0 6 4 5 ∞ ∞ Step - 2 Selected Vertices 1st Iteration
  6. 6. Example of Bellman Ford : 6 A D C B E F 0 -1 5 6 4 -2 -2 3 3 -1 A B C D E F A 0 ∞ ∞ ∞ ∞ ∞ B 0 6 4 5 ∞ ∞ 0 6 4 5 5 ∞ Step - 3 Selected Vertices 1st Iteration
  7. 7. Example of Bellman Ford : 7 A D C B E F 0 -1 5 6 4 -2 -2 3 3 -1 A B C D E F A 0 ∞ ∞ ∞ ∞ ∞ B 0 6 4 5 ∞ ∞ C 0 6 4 5 5 ∞ 0 2 4 5 5 ∞ Step - 4 Selected Vertices 1st Iteration
  8. 8. Example of Bellman Ford : 8 A D C B E F 0 -1 5 6 4 -2 -2 3 3 -1 A B C D E F A 0 ∞ ∞ ∞ ∞ ∞ B 0 6 4 5 ∞ ∞ C 0 6 4 5 5 ∞ D 0 2 4 5 5 ∞ 0 2 3 5 5 4 Step - 5 Selected Vertices 1st Iteration
  9. 9. Example of Bellman Ford : 9 A D C B E F 0 -1 5 6 4 -2 -2 3 3 -1 A B C D E F A 0 ∞ ∞ ∞ ∞ ∞ B 0 6 4 5 ∞ ∞ C 0 6 4 5 5 ∞ D 0 2 4 5 5 ∞ E 0 2 3 5 5 4 0 2 3 5 5 4 Step - 6 Selected Vertices 1st Iteration
  10. 10. Example of Bellman Ford : 10 A D C B E F 0 -1 5 6 4 -2 -2 3 3 -1 A B C D E F A 0 ∞ ∞ ∞ ∞ ∞ B 0 6 4 5 ∞ ∞ C 0 6 4 5 5 ∞ D 0 2 4 5 5 ∞ E 0 2 3 5 5 4 F 0 2 3 5 5 4 Step - 7 Final Value Selected Vertices 1st Iteration
  11. 11. After 4th iteration we will get: 11 A B C D E F A 0 1 3 5 0 3 B 0 1 3 5 0 3 C 0 1 3 5 0 3 D 0 1 3 5 0 3 E 0 1 3 5 0 3 F 0 1 3 5 0 3 Final Value Selected Vertices Example of Bellman Ford :
  12. 12. Bellman Ford Using JavaScript: 12
  13. 13. Bellman Ford Using JavaScript: 13 A B C D E F A 0 1 3 5 0 3 B 0 1 3 5 0 3 C 0 1 3 5 0 3 D 0 1 3 5 0 3 E 0 1 3 5 0 3 F 0 1 3 5 0 3 Final Value
  14. 14. THANKS EVERYONE! 14

×