diff --git a/search.ipynb b/search.ipynb index d16253be4..8effcd7f2 100644 --- a/search.ipynb +++ b/search.ipynb @@ -1639,6 +1639,41 @@ " problem=romania_problem)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 8. Iterative deepening search\n", + "\n", + "Let's change all the 'node_colors' to starting position and define a different problem statement. " + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "def iterative_deepening_search_for_vis(problem):\n", + " for depth in range(sys.maxsize):\n", + " iterations, all_node_colors, node=depth_limited_search_for_vis(problem)\n", + " if iterations:\n", + " return (iterations, all_node_colors, node)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "all_node_colors = []\n", + "romania_problem = GraphProblem('Arad', 'Bucharest', romania_map)\n", + "display_visual(romania_graph_data, user_input=False, \n", + " algorithm=iterative_deepening_search_for_vis, \n", + " problem=romania_problem)" + ] + }, { "cell_type": "markdown", "metadata": {},