Skip to content

Dijkstra's Algo

  • SSSP problems.
  • find closest node reachable and then relax other node.
  • use priority queue to handle
  • if total loop has negetive weightm then dijkstra fails.

Problem

  • City
  • V nodes, E Edges
  • There is a start node S, and there is a truck with c amount of fuel.
  • Each road has a length l and to traverse the road l fuel is needed.
  • There are some fuel tanks in the city and a price P[i] needs to be paid
  • Min cost path.

2. - Graph with weight on edges. - Pasted image 20230511112443.png