This document describes Floyd's algorithm for solving the all-pairs shortest path problem in graphs. It begins with an introduction and problem statement. It then describes Dijkstra's algorithm as a greedy method for finding single-source shortest paths. It discusses graph representations and traversal methods. Finally, it provides pseudocode and analysis for Floyd's dynamic programming algorithm, which finds shortest paths between all pairs of vertices in O(n3) time.
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.
P, NP, NP-Complete, and NP-Hard
Reductionism in Algorithms
NP-Completeness and Cooks Theorem
NP-Complete and NP-Hard Problems
Travelling Salesman Problem (TSP)
Travelling Salesman Problem (TSP) - Approximation Algorithms
PRIMES is in P - (A hope for NP problems in P)
Millennium Problems
Conclusions
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.
P, NP, NP-Complete, and NP-Hard
Reductionism in Algorithms
NP-Completeness and Cooks Theorem
NP-Complete and NP-Hard Problems
Travelling Salesman Problem (TSP)
Travelling Salesman Problem (TSP) - Approximation Algorithms
PRIMES is in P - (A hope for NP problems in P)
Millennium Problems
Conclusions
When a device has multiple paths to reach a destination, it always selects one path by preferring it over others. This selection process is termed as Routing. Routing is done by special network devices called routers or it can be done by means of software processes.The software based routers have limited functionality and limited scope.In case there are multiple path existing to reach the same destination, router can make decision based on Hop Count, Bandwidth, Metric, Prefix-length or Delay. Routing decision in networks, are mostly taken on the basis of cost between source and destination. Hop count plays major role here. Shortest path is a technique which uses various algorithms to decide a path with minimum number of hops. Common shortest path algorithms are Dijkstra's algorithm, Bellman Ford algorithm or Floyd algorithm. This presentation simplifies Floyd's algorithm with pictures and example.
As many things in the history of analysis of algorithms the all-pairs shortest path has a long history (From the point of view of Computer Science). We can see the initial results from the book “Studies in the Economics of Transportation” by Beckmann, McGuire, and Winsten (1956) where the notation that we use for
the matrix multiplication alike was first used.
In this slides, we go trough several all pairs Shortest path problem solutions from a slow version to the Johnson algorithm.
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.
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.
a graph search algorithm that solves the single-source shortest path problem for a graph with non-negative edge path costs, producing a shortest path tree. This algorithm is often used in routing and as a subroutine in other graph algorithms.
Introduction of metric dimension of circular graphs is connected graph , The distance and diameter , Resolving sets and location number then Examples . Application in facility location problems . is has motivation (Applications in Chemistry and Networks systems). Definitions of Certain Regular Graphs. Main Results for three graphs (Prism , Antiprism and generalized Petersen graphs .
Hello everyone! I am thrilled to present my latest portfolio on LinkedIn, marking the culmination of my architectural journey thus far. Over the span of five years, I've been fortunate to acquire a wealth of knowledge under the guidance of esteemed professors and industry mentors. From rigorous academic pursuits to practical engagements, each experience has contributed to my growth and refinement as an architecture student. This portfolio not only showcases my projects but also underscores my attention to detail and to innovative architecture as a profession.
Book Formatting: Quality Control Checks for DesignersConfidence Ago
This presentation was made to help designers who work in publishing houses or format books for printing ensure quality.
Quality control is vital to every industry. This is why every department in a company need create a method they use in ensuring quality. This, perhaps, will not only improve the quality of products and bring errors to the barest minimum, but take it to a near perfect finish.
It is beyond a moot point that a good book will somewhat be judged by its cover, but the content of the book remains king. No matter how beautiful the cover, if the quality of writing or presentation is off, that will be a reason for readers not to come back to the book or recommend it.
So, this presentation points designers to some important things that may be missed by an editor that they could eventually discover and call the attention of the editor.
Top 5 Indian Style Modular Kitchen DesignsFinzo Kitchens
Get the perfect modular kitchen in Gurgaon at Finzo! We offer high-quality, custom-designed kitchens at the best prices. Wardrobes and home & office furniture are also available. Free consultation! Best Quality Luxury Modular kitchen in Gurgaon available at best price. All types of Modular Kitchens are available U Shaped Modular kitchens, L Shaped Modular Kitchen, G Shaped Modular Kitchens, Inline Modular Kitchens and Italian Modular Kitchen.
Dive into the innovative world of smart garages with our insightful presentation, "Exploring the Future of Smart Garages." This comprehensive guide covers the latest advancements in garage technology, including automated systems, smart security features, energy efficiency solutions, and seamless integration with smart home ecosystems. Learn how these technologies are transforming traditional garages into high-tech, efficient spaces that enhance convenience, safety, and sustainability.
Ideal for homeowners, tech enthusiasts, and industry professionals, this presentation provides valuable insights into the trends, benefits, and future developments in smart garage technology. Stay ahead of the curve with our expert analysis and practical tips on implementing smart garage solutions.
White wonder, Work developed by Eva TschoppMansi Shah
White Wonder by Eva Tschopp
A tale about our culture around the use of fertilizers and pesticides visiting small farms around Ahmedabad in Matar and Shilaj.
Can AI do good? at 'offtheCanvas' India HCI preludeAlan Dix
Invited talk at 'offtheCanvas' IndiaHCI prelude, 29th June 2024.
https://www.alandix.com/academic/talks/offtheCanvas-IndiaHCI2024/
The world is being changed fundamentally by AI and we are constantly faced with newspaper headlines about its harmful effects. However, there is also the potential to both ameliorate theses harms and use the new abilities of AI to transform society for the good. Can you make the difference?
3. A non-linear data structure
Set of vertices and edges
Classification
◦ Undirected graph
◦ Directed graph (digraph)
Basic terminologies
◦ Path
◦ Cycle
◦ Degree
3
4. Representation
◦ Incidence Matrix
◦ Adjacency Matrix
◦ Adjacency List
◦ Path Matrix
Traversals
◦ Depth first (Stack ADT)
◦ Breadth first (Queue ADT)
4
5. Standard Problems
◦ Travelling salesman problem
◦ Minimum spanning tree problem
◦ Shortest path problem
◦ Chinese postman problem
5
6. To find the shortest path between source and
other vertices
Greedy method
Assumptions
◦ A directed acyclic graph
◦ No negative edges
Unweighted or weighted Graph
6
7. 7
Graph
Source, S
G (V,E) (S,V1)
(S,V2)
(S,V3)
.
.
(S,Vn)
Algorithm
Data
Structure
Program
Dijkstra’s
Algorithm
.
.
.
.
.
8. 8
Step 1
•Assign to every node a distance value. Set it to zero for our initial
node and to infinity for all other nodes.
Step 2
•Mark all nodes as unvisited. Set initial node as current.
Step 3
•For current node, consider all its unvisited neighbours and calculate
their distance (from the initial node).
Step 4
•If this distance is less than the previously recorded distance (infinity
in the beginning, zero for the initial node), overwrite the distance.
9. 9
Step 5
•When we are done considering all neighbours of the current node,
mark it as visited.
Step 6
•A visited node will not be checked ever again; its distance recorded
now is final and minimal.
Step 7
•Set the unvisited node with the smallest distance (from the initial
node) as the next "current node" and continue from step 3
Step 8
•Stop
10. Pseudo code
1. function Dijkstra (Graph, source):
2. for each vertex v in Graph: // Initializations
3. dist[v] := infinity // Unknown distance function from source to v
4. previous[v] := undefined // Previous node in optimal path from source
5. dist[source] := 0 // Distance from source to
source
6. Q := the set of all nodes in Graph // All nodes in the graph are unoptimized -
thus are in Q
7. while Q is not empty: // The main loop
8. u := vertex in Q with smallest dist[]
9. if dist[u] = infinity:
10. break // all remaining vertices are inaccessible from source
11. remove u from Q
12. for each neighbor v of u: // where v has not yet been removed from Q
13. alt := dist[u] + dist_between(u, v)
14. if alt < dist[v]: // Relax (u,v,a)
15. dist[v] := alt
16. previous[v] := u
17. return dist[]
Running time: O((n+|E|)log n)
10
12. Result and Scope of DA
The shortest path between a source vertex to
all other vertices have been found
Problem statement could me modified to:
◦ To find shortest path between all vertices to a
particular vertex (destination)
◦ How do I change the algorithm ?
12
13. Problem Extensions
The SINGLE-SOURCE SHORTEST PATH PROBLEM, in which
we have to find shortest paths from a source vertex v to
all other vertices in the graph.
The SINGLE-DESTINATION SHORTEST PATH PROBLEM, in
which we have to find shortest paths from all vertices in
the graph to a single destination vertex v. This can be
reduced to the single-source shortest path problem by
reversing the edges in the graph.
The ALL-PAIRS SHORTEST PATH PROBLEM, in which we
have to find shortest paths between every pair of
vertices v, v' in the graph.
13
15. All Pairs Shortest Path problem
The all-pairs shortest path algorithm is to determine
a matrix A such that A(i, j) is the length of the
shortest path between i and j.
Input given as a matrix form
Output is an nXn matrix D = [dij] where dij is the
shortest path from vertex i to j.
Wij =
0, if i=j
W(i, j), if (i,j) ε E
∞, if (i,j) ε E
15
16. Solution 1
If there are no negative cost edges apply
Dijkstra’s algorithm to each vertex (as the
source) of the digraph.
Disadvantage
Running time increases to O(n(n+|E|)log n)
Therefore we go for Dynamic Programming
16
17. 17
Dynamic Programming
An algorithm design method that can be used
when the solution to the problem can be viewed
as a result of a sequence of decisions.
Best examples:
Ordering matrix multiplication
Optimal binary search trees
All pairs-shortest path
18. 18
Solution 2
To find the shortest path from i to j (i!=j)
Assume some intermediate vertex k (or no
vertices also)
The shortest path from i to j is the shortest
path from [(i,k) + (k,j) or i to j ] which ever is
shorter.
We use associated matrices and its powers to
calculate the shortest path from i to k and also
k to j.
Matrix obtained in O(n.n.n)
20. 20
Pseudo Code
1. algorithm allpairs (cost, A, n):
2. //cost[1:n, 1:n] is the cost adjacency matrix of a graph with n
vertices
3. //A[i,j] is the cost of a shortest path from vertex i toj .
4. //cost[i,i] = 0 for 1<=i<=n.
5. {
6. for(i=0;i<n;i++)
7. for(j=0;j<n;j++)
8. A[i][j]=cost[i][j] //copy cost into A
9. for(k=0;k<n;k++)
10. for(i=0;i<n;i++)
11. for(j=0;j<n;j++)
12. A[i,j] = min { A[i,j] , A[i,k] + A[k,j] };
13. }
21. 21
Applications
To automatically find directions between
physical locations
Vehicle Routing and scheduling
In a networking or telecommunication
applications, Dijkstra’s algorithm has been used
for solving the min-delay path problem (which
is the shortest path problem). For example in
data network routing, the goal is to find
the path for data packets to go through a
switching network with minimal delay.
23. 23
A Real Life Problem
Whole pineapples are served in a restaurant in London. To
ensure freshness, the pineapples are purchased in Hawaii and air
freighted from Honolulu to Heathrow in London. The following
network diagram outlines the different routes that the
pineapples could take.
105
68
57
76
65
88
105
4875
44
63
56
71
24. 24
References
Data Structures and Algorithm Analysis in C,
Second Edition, M.A. Weiss
Fundamentals of Computer Algorithms, Second
Edition, Ellis Horowitz, Sartaj Sahni,
Sanguthevar Rajasekaran
Introduction to Design and Analysis of
Algorithms, Fifth Edition, Anany Levitin