Coders Packet

Travel Planner App (Real Life Based Example)

By UDDESHYA PANKAJ

This App is used to find the shortest distance from source node to destination node, but I have added Plane travels as well as Bus travels.

Suppose there are V vertices and E edges, and we are given source vertex and Destination vertex.

We have to find minimum distance it should cost to reach Destination vertex, but the real twist occurs here is that in the problem its given two modes of travel exists. First is Bus and the Second is Flight , the constraint added here is that we can take the flight only once only.

So, normally we cannot apply dijkstra's Algorithm here as flight is to be taken only once , if we are taking flight.

 

So, to solve this problem we have to design a seperate function for travelflights which takes minimum distance which we got from dijkstra's Algortihm

and then we will apply same algorithm but now we will take that nodes which requires flights so, then we compare the distance when travel by flight with the minimum distance we got from Bus, if we travvled and if its less we will update the minimum distance from source node to destination node.

 

This is a really interesting problem , and we saw here more modifications of Dijkstra's Algorithm.

So, its really good app to make and is based on real life example.

 

I have used HTML,CSS,JAVASCRIPT and i used a  LIBRARY called VIS.JS  for beautiful Animation.

You can check the library at  https://visjs.org/

Here we got minimum cost to reach from delhi to banglore.

Download Complete Code

Comments

No comments yet