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%.
- Computer Networks | Unicast Routing - Link State Routing
- 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
- Dijkstra's shortest path algorithm | Greedy Algo-7
- Printing Paths in Dijkstra's Shortest Path Algorithm
- Shortest path in a Binary Maze
- Some interesting shortest path questions | Set 1
- 0-1 BFS (Shortest Path in a Binary Weight Graph)
- Dijkstra's shortest path with minimum edges
- Shortest Path in Directed Acyclic Graph
- Computer Network | Distance vector routing v/s Link state routing
- Computer Network | Routing Protocols Set 1 (Distance Vector Routing)
- Computer Network | Open shortest path first (OSPF) - Set 2
- Shortest path with exactly k edges in a directed and weighted graph
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.