DEV Community


Discussion on: Dijkstra's algorithm in python: algorithms for beginners

mistertellini profile image
Aitor López

Hello back,

I was finally able to find a solution to change the weights dynamically during the search process, however, I am still not sure about how to impose the condition of having a path of length >= N, being N the number of traversed edges. The only idea I have come up with would consist on turning to infinity the last edge towards my destination vertex if the overall distance lies below N. However, this would make this edge no longer available for use for the other paths that would arrive to destination vertex. Any ideas from your side folks? Many thanks in advance, and best regards!

Forem Open with the Forem app