Dijkstra with modification

Правка en2, от 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.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Doubt-_- 2021-06-22 12:03:39 3 Tiny change: 'en iteration thru each' -> 'en iterating thru each'
en1 Английский Doubt-_- 2021-06-22 11:53:50 681 Initial revision (published)