My homework is implementing algorithms BFS, DFS, depth-limited and IDS for the map as a 2D grid with 8 directions of movement. I read that the IDS algorithm is optimal, but in my case is not optimal paths.

Is the IDS algorithm optimal for graphs (e.g. map as a grid), or does optimality only apply to searching trees?


migrated from stackoverflow.com Sep 24 '12 at 18:39

This question came from our site for professional and enthusiast programmers.

  • $\begingroup$ IDS should be optimal if it's a simple grid traversal where the traveling cost is the same everywhere (see Wikipedia). Maybe check your implementation? $\endgroup$ – irrelephant Jul 29 '12 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy