||Graphic Simulation for Shortest & 2nd shortest path in a Weighted Graph using Dijkstra's Algorithm.
||Abhishek .H. Dwivedi
||yarrows [at] indiatimes.com
||This program is used as a simulation for routing packets between routers. There are 2 subnets, one of whose weights will have to be entered by the user(positive only).The user will be asked for the source and destination nodes, for which he has a choice of 0 to 7 ONLY.(These are the numbers alotted to the nodes).
The graphic part will show a green colored line drawn from the source to the destination, that indicates the shortest path. This is calculated by Dijkstra's algorithm. If one more packet is desired, a second shortest path is chosen to avoid traffic.
This is indicated by the red colored path. Finally, the user enters source and dest for subnet 2(0 to 7 ONLY).The destination from 1st subnets forwards the packet to the source of 2nd subnet, and from there by the shortest path to the destnation of the 2nd subnet.
||C++ » Algorithms
|| Select and Copy the Code