The document discusses several shortest path algorithms for graphs, including Dijkstra's algorithm, Bellman-Ford algorithm, and Floyd-Warshall algorithm. Dijkstra's algorithm finds the shortest path from a single source node to all other nodes in a graph with non-negative edge weights. Bellman-Ford can handle graphs with negative edge weights but is slower. Floyd-Warshall can find shortest paths in a graph between all pairs of nodes.
The solution to the single-source shortest-path tree problem in graph theory. This slide was prepared for Design and Analysis of Algorithm Lab for B.Tech CSE 2nd Year 4th Semester.
One of the main reasons for the popularity of Dijkstra's Algorithm is that it is one of the most important and useful algorithms available for generating (exact) optimal solutions to a large class of shortest path problems. The point being that this class of problems is extremely important theoretically, practically, as well as educationally.
The solution to the single-source shortest-path tree problem in graph theory. This slide was prepared for Design and Analysis of Algorithm Lab for B.Tech CSE 2nd Year 4th Semester.
One of the main reasons for the popularity of Dijkstra's Algorithm is that it is one of the most important and useful algorithms available for generating (exact) optimal solutions to a large class of shortest path problems. The point being that this class of problems is extremely important theoretically, practically, as well as educationally.
This presentation gives a conceptual idea of a graphical algorithm that is Dijkstra's Algorithm. Includes general introduction , the pseudocode, code in form of QR Card, graphical. Also discussing the algorithm in form of graphical images and nodes. Also it include the complexity and application of algorithm in various ranges of fields. This is a fun, eye-catching, conceptual presentation, best suited for students into engineering.
It is related to Analysis and Design Of Algorithms Subject.Basically it describe basic of topological sorting, it's algorithm and step by step process to solve the example of topological sort.
The Bellman–Ford algorithm is an algorithm that computes shortest paths from a single source vertex to all of the other vertices in a weighted digraph.
A presentation on prim's and kruskal's algorithmGaurav Kolekar
This slides are for a presentation on Prim's and Kruskal's algorithm. Where I have tried to explain how both the algorithms work, their similarities and their differences.
This presentation gives a conceptual idea of a graphical algorithm that is Dijkstra's Algorithm. Includes general introduction , the pseudocode, code in form of QR Card, graphical. Also discussing the algorithm in form of graphical images and nodes. Also it include the complexity and application of algorithm in various ranges of fields. This is a fun, eye-catching, conceptual presentation, best suited for students into engineering.
It is related to Analysis and Design Of Algorithms Subject.Basically it describe basic of topological sorting, it's algorithm and step by step process to solve the example of topological sort.
The Bellman–Ford algorithm is an algorithm that computes shortest paths from a single source vertex to all of the other vertices in a weighted digraph.
A presentation on prim's and kruskal's algorithmGaurav Kolekar
This slides are for a presentation on Prim's and Kruskal's algorithm. Where I have tried to explain how both the algorithms work, their similarities and their differences.
Overview of Single Source Shortest Path
Types of Single Source Shortest Path Algorithm
Representation of Single Source Shortest Path
Initialization
Relaxation
Implementation of Dijkstra's Algorithm
Does Dijkstra’s Algorithm Always Work?
Implementation of Bellman-Ford Algorithm
Negative Weight Cycles in Bellman-Ford Algorithm
This is a presentation by Dada Robert in a Your Skill Boost masterclass organised by the Excellence Foundation for South Sudan (EFSS) on Saturday, the 25th and Sunday, the 26th of May 2024.
He discussed the concept of quality improvement, emphasizing its applicability to various aspects of life, including personal, project, and program improvements. He defined quality as doing the right thing at the right time in the right way to achieve the best possible results and discussed the concept of the "gap" between what we know and what we do, and how this gap represents the areas we need to improve. He explained the scientific approach to quality improvement, which involves systematic performance analysis, testing and learning, and implementing change ideas. He also highlighted the importance of client focus and a team approach to quality improvement.
Ethnobotany and Ethnopharmacology:
Ethnobotany in herbal drug evaluation,
Impact of Ethnobotany in traditional medicine,
New development in herbals,
Bio-prospecting tools for drug discovery,
Role of Ethnopharmacology in drug evaluation,
Reverse Pharmacology.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
What is the purpose of the Sabbath Law in the Torah. It is interesting to compare how the context of the law shifts from Exodus to Deuteronomy. Who gets to rest, and why?
How to Create Map Views in the Odoo 17 ERPCeline George
The map views are useful for providing a geographical representation of data. They allow users to visualize and analyze the data in a more intuitive manner.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
Andreas Schleicher presents at the OECD webinar ‘Digital devices in schools: detrimental distraction or secret to success?’ on 27 May 2024. The presentation was based on findings from PISA 2022 results and the webinar helped launch the PISA in Focus ‘Managing screen time: How to protect and equip students against distraction’ https://www.oecd-ilibrary.org/education/managing-screen-time_7c225af4-en and the OECD Education Policy Perspective ‘Students, digital devices and success’ can be found here - https://oe.cd/il/5yV
How to Split Bills in the Odoo 17 POS ModuleCeline George
Bills have a main role in point of sale procedure. It will help to track sales, handling payments and giving receipts to customers. Bill splitting also has an important role in POS. For example, If some friends come together for dinner and if they want to divide the bill then it is possible by POS bill splitting. This slide will show how to split bills in odoo 17 POS.
2. Shortest Path Algorithm
An algorithm that is designed essentially to
find a path of minimum length between two
specified vertices of a connected weighted
graph.
3. Single source Shortest path algorithm
o It is defined as
Cost of shortest path from a source
vertex u to a destination v.
s a
b c
4. Dijkstra’s Algorithm
Dijkstra’s algorithm is a greedy algorithm for
solving single source shortest path problem
that provide us with the shortest path from one
particular source node to all other nodes in the
given graph .
5. Rules of Dijkstra’s algorithm
It can be applied on both directed and undirected
graph.
It is applied on weighted graph.
For the algorithm to be applicable the graph must
be connected.
a 3 b
4 5 1
c d
4
6. Cont…
Dijkstra’s algorithm does not work for graphs with
negative weight edges. For graphs with negative
weight edges, Bellman_ford algorithm can be used.
In Dijkstra’s algorithm always assign source vertex to
zero distance.
Assign every other node a tentative distance.
7. Dijkstra’s AlgorithmDijkstra’s(G,W,S)
INITIALIZE-SINGLE-SOURCE(G,s)
1. for each vertex v ∈ 𝐺. 𝑉
2. v.d = ∞
3. v.𝜋 = 𝑁𝐼𝐿
4. s.d = 0
5. S = ∅
6. Q = G.V
7. while (Q≠ ∅)
8. u = dequeue_min(Q)
9. S = S ∪ 𝑢
10. for each vertex v∈ 𝐴𝑑𝑗 𝑢
11. if( v.d > u.d+ w(u,v) )
12. v.d = u.d + w (u,v) // update distance of v
13. v. 𝜋 = u
14. return v.d
8. BellMan-Algorithm
Bellman–Ford algorithm. The Bellman–Ford
algorithm is an algorithm that computes shortest
paths from a single source vertex to all of the other
vertices in a weighted digraph. ... Negative edge
weights are found in various applications of graphs,
hence the usefulness of this algorithm.
9. Cont..
It is similar to Dijkstra's algorithm but it can work
with graphs in which edges can have negative
weights.
Negative weight edges can create negative weight
cycles i.e. a cycle which will reduce the total path
distance by coming back to the same point.
10. Cont..
Shortest path algorithms
like Dijkstra's Algorithm that
aren't able to detect such a
cycle can give an incorrect
result because they can go
through a negative weight
cycle and reduce the path
length.
A B D E
2
1 3
2 -4
C
11. Uses of Algorithm
This algorithm can be used on both weighted and
unweighted graphs.
Like Dijkstra's shortest path algorithm, the Bellman-Ford
algorithm is guaranteed to find the shortest path in a graph.
Though it is slower than Dijkstra's algorithm, Bellman-Ford is
capable of handling graphs that contain negative edge
weights, so it is more versatile.
12. ALGORITHM
1. for v in V:
2. v.distance = infinity
3. v.p = None
4. source.distance = 0
5. for i from 1 to |V| - 1:
6. for (u, v) in E:
7. relax(u, v)
13. Explanation
The first for loop sets the distance to each vertex in
the graph to infinity. This is later changed for the
source vertex to equal zero. Also in that first for loop,
the p value for each vertex is set to nothing. This
value is a pointer to a predecessor vertex so that we
can create a path later.
The next for loop simply goes through each edge (u,
v) in E and relaxes it. This process is done |V| - 1 times.
14. Relaxation Equation
Relaxation is the most important step in Bellman-
Ford. It is what increases the accuracy of the
distance to any given vertex. Relaxation works by
continuously shortening the calculated distance
between vertices comparing that distance with
other known distances.
15. Example
Take the baseball example from earlier. Let's say I think the
distance to the baseball stadium is 20 miles. However, I know
that the distance to the corner right before the stadium is 10
miles, and I know that from the corner to the stadium, the
distance is 1 mile. Clearly, the distance from me to the
stadium is at most 11 miles. So, I can update my belief to
reflect that. That is one cycle of relaxation, and it's done over
and over until the shortest paths are found
17. Negative Cycle
Detecting Negative Cycles
A very short and simple addition to the Bellman-Ford
algorithm can allow it to detect negative cycles, something
that is very important because it disallows shortest-path
finding altogether. After the Bellman-Ford algorithm
shown above has been run, one more short loop is required
to check for negative weight cycles.
This psuedo-code is written as a high level descrpition of the
algorithm, not an implementation.
18. Cont..
1. for v in V:
2. v.distance = infinity
3. v.p = None
4. source.distance = 0
5. for i from 1 to |V| - 1:
6. for (u, v) in E:
7. relax(u, v) for (u, v) in E:
8. if v.distance > u.distance + weight(u, v):
9. print "A negative weight cycle exists"
19. Floyed Warshall ALgorithm
Floyd–Warshall algorithm is an algorithm for
finding shortest paths in a weighted graph
The Graph may be weighted with positive or
negative edge weights .
The Graph may be directed or undirected.
20. Cont..
If a node has not a direct path or
link to any other node then the
distance between these nodes
are infinite.
If only one path between the two
nodes or vertices then it said to
be the shortest distance.
The distance of a vertex to itself is
0.
Vo 10 V3
5 1
3
V1 V2
22. Uses Of Shortest Path Algorithm
Weighted graph
Distance function or array
Priority Queue
Relaxation
23. Applications of Shortest Path Algorithm
It is used in Google Map.
It is used in finding Shortest Path.
It is used in geographical Maps.
To find locations of Map which refers to vertices of
graph.
Distance between the location refers to edges.
It is used in IP routing to find Open shortest Path First.
It is used in the telephone network.