0

Question: Find an algorithm which returns the weight of a lightest path between all paths with a weight divided by three in a graph with natural weights of the edges.

My instructor has given me a hint of doing calculations modulo three and creating a new graph and applying Dijkstra's algorithm on it.

I have no idea how to solve this question and I would be happy to get your help with a hint or a direction.

Thank you

Zara Levin
  • 101
  • 2

1 Answers1

2

Since you asked for a hint: study the answer to How hard is finding the shortest path in a graph matching a given regular language? and understand it deeply. Then think about how to apply similar ideas.

D.W.
  • 167,959
  • 22
  • 232
  • 500