Dijkstra with modification

Revision en2, by Doubt-_-, 2021-06-22 12:03:39

If you are given a weighted and directed graph, which can have multi-edges between nodes. Each edge will have a color associated with it (let it be i). Find the shortest path between node A and node B, if there are multiples shortest paths, print the shortest path with the least number of colors in it. What can be the optimized solution for this?

Anything better than finding all shorted paths and then iterating thru each one and finding different colors for each, and printing the one with the least number of colors..?

If there's a similar question on the internet and someone can provide me a link for that, it would be really helpful.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Doubt-_- 2021-06-22 12:03:39 3 Tiny change: 'en iteration thru each' -> 'en iterating thru each'
en1 English Doubt-_- 2021-06-22 11:53:50 681 Initial revision (published)