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

  • 1
    $\begingroup$ What did you try? Where did you get stuck? We're happy to help you understand the concepts but just solving exercises for you is unlikely to achieve that. You might find this page helpful in improving your question. $\endgroup$ – Nathaniel Jun 5 at 9:40
  • $\begingroup$ Perhaps I wasn't clear in my question. I agree, I want to learn through solving this question so it would not be useful for me to get a full solution. I would be happy to hear a direction or a hint for solving. I edited my question. $\endgroup$ – FAF Jun 5 at 9:44
  • $\begingroup$ I don't know what "the weight of a lightest path between all paths" means. Where did you encounter this task? I suggest crediting the source. $\endgroup$ – D.W. Jun 6 at 5:58

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.


Not the answer you're looking for? Browse other questions tagged or ask your own question.