Data transfer operations is a crucial aspect in case of networking and routing. So efficient data transfer operations is a must need, with minimum hardware cost (Optical Cables, WDM Network components, Decoders, Multiplexers) and also in the minimum time possible. Thus, the need is to propose an algorithm that finds the shortest path between two nodes (source node and destination node).
Let’s see a completely new algorithm unlike Dijkstra’s Shortest Path or any other algorithm for finding Shortest Path.
Given a graph and two nodes (source node and destination node), find the shortest path between them.
Let’s Calculate the distance ratio for each link :
Distance of link AB [denoted by
d(AB)] = 10
Distance of link AC [denoted by
d(AC)] = 12
For link AB, Distance Ratio of AB = d(AB) / (d(AB) + d(AC))
For link AC, Distance Ratio of AC = d(AC) / (d(AB) + d(AC))
Given a graph and two nodes - 1. Find all the paths connecting the two nodes. 2. For each path calculate probability = (Distance Ratio). 3. After looping over all such paths, find the path for which the probability turns out to be minimum.
Input : Output : Shortest Path is [A -> B] Explanation : All possible paths are P1 = [A->B] P2 = [A->C->B] P3 = [A->D->B] total distance D = d(P1) + d(P2) + d(P3) = (3) + (2 + 5) + (4 + 3) = 17 distance ratio for P1 = d(P1) / D = 3/17 distance ratio for P2 = d(P2) / D = 7/17 distance ratio for P3 = d(P3) / D = 7/17 So the shortest path is P1 = [A->B] Input : Output : Shortest Path is [A -> B]
Let’s illustrate the algorithm with a 7-node network and find out the Probabilistic shortest path between
node 1 and
Below is the implementation :
Shortest Path is [1, 2, 5]
Advantage over common Shortest Path Algorithms :
Most of the shortest path algorithms are greedy algorithms. So its based on the fact that an optimal solution leads to a globally optimal solution. In most of the cases, due to greedy property, it may not always lead to an optimal solution. But using this algorithm, one can always guarantee an optimal solution and hence the accuracy is 100%.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Difference between Classful Routing and Classless Routing
- Difference between Distance vector routing and Link State routing
- Unicast Routing - Link State Routing
- Gigabit Passive Optical Networks (GPON) Fundamentals
- Introduction of Probabilistic Computing
- Dijkstra's shortest path algorithm | Greedy Algo-7
- Printing Paths in Dijkstra's Shortest Path Algorithm
- Dijkstra’s shortest path algorithm using set in STL
- Dijkstra's Shortest Path Algorithm using priority_queue of STL
- Dijkstra's shortest path algorithm in Java using PriorityQueue
- D'Esopo-Pape Algorithm : Single Source Shortest Path
- Synchronous Optical Network (SONET)
- Difference between Optical Fiber and Coaxial Cable
- Difference between Satellite Communication and Optical Communication
- Difference between Twisted Pair Cable and Optical Fiber Cable
- Difference between Twisted pair cable, Co-axial cable and Optical fiber cable
- Shortest Path in Directed Acyclic Graph
- Some interesting shortest path questions | Set 1
- Shortest path with exactly k edges in a directed and weighted graph
- Shortest Path in a weighted Graph where weight of an edge is 1 or 2
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.