SlideShare a Scribd company logo
1 of 18
Submitted By:
Md. Mejanur Rahman
Id: 183015125
Department Of CSE
Green University Of Bangladesh
Submitted To:
Jargis Ahmed
Lecture Dept. of CSE
Welcome To My Presentation
2
Presentation Topic:
BFS UVA 336 and Bellman Ford UVA 558
3
CONTENT:
 Introduction
 BFS Algorithm
 Example of BFS algorithm
 Bellman Ford Algorithm
 Concluding remark
4
Algorithm means “a process or set of rules to be followed in
calculations or other problem-solving operations”.
Introduction:
5
Algorithm:
 I read the number of edges while edges != 0.
 Read the graph.
 Read the node to search and the ttl while node !=0
and ttl != 0.
 Call bfs(node) and init not Reach = 0.
 Traverse all the calculated distance from node. If
(distance > ttl) notReach+1;
 Traverse the visited map. If an node is not visited.
notReach+1.
 Print not Reach.
6
 The nodes does not follow a correlative order.
 Care full with the nodes that are not connected in the
bfs request.(check my case)
Hint of Solution:
7
Source Code:
8
9
10
Bellman Ford Algorithm:
The Bellman-Ford algorithm is one of the classic solutions to this
problem. It calculates the shortest path to all nodes in the graph from
a single source.
11
Bellman Ford Algorithm Graph:
12
Bellman Ford Algorithm :
 Start by considering that the shortest path to all nodes, less the source, is infinity.
Mark the length of the path to the source as 0
 Take every edge and try to relax it
 Relaxing an edge means checking to see if the path to the node the edge is
pointing to can’t be shortened, and if so, doing it. In the above graph, by checking
the edge 1 -> 2 of length 6, you find that the length of the shortest path to node
1 plus the length of the edge 1 -> 2 is less then infinity. So, you replace infinity
in node 2 with 6.
13
Tricky Lines :
1.starting from our solar system, it is always possible to end up in any
star system by following a sequence of wormholes
2.Between any pair of star systems, there is at most one wormhole in
either direction.
14
Source Code:
15
16
17
The basic idea of implementing curiosity and boredom is not limited to the
particular algorithm described in the first section. Every model-dependent
on-line algorithm for learning goal directed behavior might be augmented by
a similar implementation of `the desire to improve the world model'.
Concluding remark:
18
Thank You

More Related Content

Similar to Presentation on BFS & Bellman Ford.pptx

An optimized hybrid approach for path
An optimized hybrid approach for pathAn optimized hybrid approach for path
An optimized hybrid approach for pathijfcstjournal
 
The leader algorithm (Horrigan [394]) represents each cluster using a.pdf
The leader algorithm (Horrigan [394]) represents each cluster using a.pdfThe leader algorithm (Horrigan [394]) represents each cluster using a.pdf
The leader algorithm (Horrigan [394]) represents each cluster using a.pdfmallik3000
 
Comparison of tsp algorithms
Comparison of tsp algorithmsComparison of tsp algorithms
Comparison of tsp algorithmsKaal Nath
 
Algorithm chapter 11
Algorithm chapter 11Algorithm chapter 11
Algorithm chapter 11chidabdu
 
A Comprehensive and Comparative Study Of Maze-Solving Techniques by Implement...
A Comprehensive and Comparative Study Of Maze-Solving Techniques by Implement...A Comprehensive and Comparative Study Of Maze-Solving Techniques by Implement...
A Comprehensive and Comparative Study Of Maze-Solving Techniques by Implement...IOSR Journals
 
Nelder Mead Search Algorithm
Nelder Mead Search AlgorithmNelder Mead Search Algorithm
Nelder Mead Search AlgorithmAshish Khetan
 
shortestpathalgorithm-180109112405 (1).pdf
shortestpathalgorithm-180109112405 (1).pdfshortestpathalgorithm-180109112405 (1).pdf
shortestpathalgorithm-180109112405 (1).pdfzefergaming
 
The Traveling Salesman problem ppt.pptx
The Traveling Salesman problem ppt.pptxThe Traveling Salesman problem ppt.pptx
The Traveling Salesman problem ppt.pptxHalimFerchichi
 
Grid Based Autonomous Navigator
Grid Based Autonomous Navigator Grid Based Autonomous Navigator
Grid Based Autonomous Navigator Sayeed Mohammed
 
CSA 2001 (Module-2).pptx
CSA 2001 (Module-2).pptxCSA 2001 (Module-2).pptx
CSA 2001 (Module-2).pptxPranjalKhare13
 
Shortest path algorithm
Shortest path algorithmShortest path algorithm
Shortest path algorithmsana younas
 
Graph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First SearchGraph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First SearchAmrinder Arora
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound techniqueishmecse13
 
Accelerated Bat Algorithm For Solving Integer Programming Problems
Accelerated Bat Algorithm For Solving Integer Programming ProblemsAccelerated Bat Algorithm For Solving Integer Programming Problems
Accelerated Bat Algorithm For Solving Integer Programming ProblemsTye Rausch
 

Similar to Presentation on BFS & Bellman Ford.pptx (20)

An optimized hybrid approach for path
An optimized hybrid approach for pathAn optimized hybrid approach for path
An optimized hybrid approach for path
 
Data structure note
Data structure noteData structure note
Data structure note
 
The leader algorithm (Horrigan [394]) represents each cluster using a.pdf
The leader algorithm (Horrigan [394]) represents each cluster using a.pdfThe leader algorithm (Horrigan [394]) represents each cluster using a.pdf
The leader algorithm (Horrigan [394]) represents each cluster using a.pdf
 
A greedy algorithms
A greedy algorithmsA greedy algorithms
A greedy algorithms
 
Comparison of tsp algorithms
Comparison of tsp algorithmsComparison of tsp algorithms
Comparison of tsp algorithms
 
36 greedy
36 greedy36 greedy
36 greedy
 
Algorithm chapter 11
Algorithm chapter 11Algorithm chapter 11
Algorithm chapter 11
 
Notion of Algorithms.pdf
Notion of Algorithms.pdfNotion of Algorithms.pdf
Notion of Algorithms.pdf
 
The Floyd–Warshall algorithm
The Floyd–Warshall algorithmThe Floyd–Warshall algorithm
The Floyd–Warshall algorithm
 
A Comprehensive and Comparative Study Of Maze-Solving Techniques by Implement...
A Comprehensive and Comparative Study Of Maze-Solving Techniques by Implement...A Comprehensive and Comparative Study Of Maze-Solving Techniques by Implement...
A Comprehensive and Comparative Study Of Maze-Solving Techniques by Implement...
 
E017142429
E017142429E017142429
E017142429
 
Nelder Mead Search Algorithm
Nelder Mead Search AlgorithmNelder Mead Search Algorithm
Nelder Mead Search Algorithm
 
shortestpathalgorithm-180109112405 (1).pdf
shortestpathalgorithm-180109112405 (1).pdfshortestpathalgorithm-180109112405 (1).pdf
shortestpathalgorithm-180109112405 (1).pdf
 
The Traveling Salesman problem ppt.pptx
The Traveling Salesman problem ppt.pptxThe Traveling Salesman problem ppt.pptx
The Traveling Salesman problem ppt.pptx
 
Grid Based Autonomous Navigator
Grid Based Autonomous Navigator Grid Based Autonomous Navigator
Grid Based Autonomous Navigator
 
CSA 2001 (Module-2).pptx
CSA 2001 (Module-2).pptxCSA 2001 (Module-2).pptx
CSA 2001 (Module-2).pptx
 
Shortest path algorithm
Shortest path algorithmShortest path algorithm
Shortest path algorithm
 
Graph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First SearchGraph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First Search
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
 
Accelerated Bat Algorithm For Solving Integer Programming Problems
Accelerated Bat Algorithm For Solving Integer Programming ProblemsAccelerated Bat Algorithm For Solving Integer Programming Problems
Accelerated Bat Algorithm For Solving Integer Programming Problems
 

More from MejanurRahmanJunayed

More from MejanurRahmanJunayed (10)

Presentation-Mysofthaven.pptx
Presentation-Mysofthaven.pptxPresentation-Mysofthaven.pptx
Presentation-Mysofthaven.pptx
 
Midterm assignment.ppt
Midterm assignment.pptMidterm assignment.ppt
Midterm assignment.ppt
 
Transmission Media.pptx
Transmission Media.pptxTransmission Media.pptx
Transmission Media.pptx
 
Campus Network Design Presentaion.pptx
Campus Network Design Presentaion.pptxCampus Network Design Presentaion.pptx
Campus Network Design Presentaion.pptx
 
Linear Algebra and Vector analysys.ppt
Linear Algebra and Vector analysys.pptLinear Algebra and Vector analysys.ppt
Linear Algebra and Vector analysys.ppt
 
Mobile cloud computing.pptx
Mobile cloud computing.pptxMobile cloud computing.pptx
Mobile cloud computing.pptx
 
Adder.ppt
Adder.pptAdder.ppt
Adder.ppt
 
Final Assignment.ppt
Final Assignment.pptFinal Assignment.ppt
Final Assignment.ppt
 
System maintenance.ppt
System maintenance.pptSystem maintenance.ppt
System maintenance.ppt
 
hospital management system.pptx
hospital management system.pptxhospital management system.pptx
hospital management system.pptx
 

Recently uploaded

University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 

Recently uploaded (20)

University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 

Presentation on BFS & Bellman Ford.pptx

  • 1. Submitted By: Md. Mejanur Rahman Id: 183015125 Department Of CSE Green University Of Bangladesh Submitted To: Jargis Ahmed Lecture Dept. of CSE Welcome To My Presentation
  • 2. 2 Presentation Topic: BFS UVA 336 and Bellman Ford UVA 558
  • 3. 3 CONTENT:  Introduction  BFS Algorithm  Example of BFS algorithm  Bellman Ford Algorithm  Concluding remark
  • 4. 4 Algorithm means “a process or set of rules to be followed in calculations or other problem-solving operations”. Introduction:
  • 5. 5 Algorithm:  I read the number of edges while edges != 0.  Read the graph.  Read the node to search and the ttl while node !=0 and ttl != 0.  Call bfs(node) and init not Reach = 0.  Traverse all the calculated distance from node. If (distance > ttl) notReach+1;  Traverse the visited map. If an node is not visited. notReach+1.  Print not Reach.
  • 6. 6  The nodes does not follow a correlative order.  Care full with the nodes that are not connected in the bfs request.(check my case) Hint of Solution:
  • 8. 8
  • 9. 9
  • 10. 10 Bellman Ford Algorithm: The Bellman-Ford algorithm is one of the classic solutions to this problem. It calculates the shortest path to all nodes in the graph from a single source.
  • 12. 12 Bellman Ford Algorithm :  Start by considering that the shortest path to all nodes, less the source, is infinity. Mark the length of the path to the source as 0  Take every edge and try to relax it  Relaxing an edge means checking to see if the path to the node the edge is pointing to can’t be shortened, and if so, doing it. In the above graph, by checking the edge 1 -> 2 of length 6, you find that the length of the shortest path to node 1 plus the length of the edge 1 -> 2 is less then infinity. So, you replace infinity in node 2 with 6.
  • 13. 13 Tricky Lines : 1.starting from our solar system, it is always possible to end up in any star system by following a sequence of wormholes 2.Between any pair of star systems, there is at most one wormhole in either direction.
  • 15. 15
  • 16. 16
  • 17. 17 The basic idea of implementing curiosity and boredom is not limited to the particular algorithm described in the first section. Every model-dependent on-line algorithm for learning goal directed behavior might be augmented by a similar implementation of `the desire to improve the world model'. Concluding remark: