I am trying to solve the following problem: Given a directed graph, there is a robot in the start and it needs to reach the destination. Each movement takes 1 second, and every second the graph reverses each edges. The robot can stay at a node and wait for 1 second in order for the graph to reverse again. The goal is to reach the destination in the shortest time possible.
Obviously since each movement takes 1 second, we can assume that each movement doesn't cost anything, but the fact that in every second the graph reverses its edges still remains. Also, since the graph is not weighted, I think Dijkstra's algorithm is not very suitable.
My "algorithm" uses BFS in the following way: first the graph is partitioned in levels. The nodes of each level need only 1 step (second) to be reached from the previous one, but every other level has the edges reversed. So the robot starts from the root that has the initial edges, then the nodes that are directly accessible from the root have reversed edges towards the nodes that are closer to the destination etc etc. The robots calculates at every level, if there is a path that starts from the current node to the destination node. If there is, it moves to the next node in that path, since this step is the best one. If not, then it waits for 1 second for the edges to be reversed (final_time++) and then moves to that node.
I am pretty sure that my algorithm is not great and I am not sure if it would work. Also, I am thinking that I would need some type of backtracking in case it reaches a node from which the destination is unreachable.
Any comments or tips on how to construct a better solution? I am not asking for the solution, but for corrections and possibly some hints that will make me find/fix the algorithm. Sorry if some points are not very well explained, English isn't my mother tongue. I am happy to clarify if something is not clear enough.