So I have a grid-like graph. Let's say I want to go from (1,1) to (3,3). Assuming all edges are equally weighted, BFS will clearly return multiple paths (of same total cost). Is there a way to choose paths (among the shortest paths) that maximizes turns ?
So in the example (1,1) -> (1,2) -> (1,3) -> (2,3) -> (3,3) and (1,1) -> (1,2) -> (2,2) -> (2,3) -> (3,3) have the same length, but the second one will be a more desired path.
I know I can generate all paths then filter the results. But I'm wondering if there's a way to do it within the search. I was thinking about changing the order of how neighbor nodes are pushed into the queue. However I can't prove that it will work.
Any help, hint or guidance is appreciated!