Skip to content

Commit c5c964e

Browse files
ed-wordnorvig
authored andcommitted
Update search.ipynb (#359)
1 parent f51888a commit c5c964e

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

search.ipynb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@
273273
"initial_node_colors = dict(node_colors)\n",
274274
" \n",
275275
"# positions for node labels\n",
276-
"node_label_pos = {k:[v[0],v[1]-10] for k,v in romania_locations.items()}\n",
276+
"node_label_pos = { k:[v[0],v[1]-10] for k,v in romania_locations.items() }\n",
277277
"\n",
278278
"# use this while labeling edges\n",
279279
"edge_labels = dict()\n",
@@ -283,6 +283,7 @@
283283
" connections = romania_map.get(node)\n",
284284
" for connection in connections.keys():\n",
285285
" distance = connections[connection]\n",
286+
"\n",
286287
" # add edges to the graph\n",
287288
" G.add_edge(node, connection)\n",
288289
" # add distances to edge_labels\n",
@@ -293,7 +294,7 @@
293294
"cell_type": "markdown",
294295
"metadata": {},
295296
"source": [
296-
"We have completed building our graph based on romania_map and its locations. It's time to display it here in the notebook. This function `show_map(node_colors)` helps us do that. We will be calling this function later on to display the map at each and every interval step while searching using variety of algorithms from the book."
297+
"We have completed building our graph based on romania_map and its locations. It's time to display it here in the notebook. This function `show_map(node_colors)` helps us do that. We will be calling this function later on to display the map at each and every interval step while searching, using variety of algorithms from the book."
297298
]
298299
},
299300
{
@@ -438,7 +439,7 @@
438439
" \n",
439440
" for i in range(slider.max + 1):\n",
440441
" slider.value = i\n",
441-
" # time.sleep(.5)\n",
442+
" #time.sleep(.5)\n",
442443
" \n",
443444
" slider = widgets.IntSlider(min=0, max=1, step=1, value=0)\n",
444445
" slider_visual = widgets.interactive(slider_callback, iteration = slider)\n",
@@ -530,13 +531,15 @@
530531
" all_node_colors = []\n",
531532
" node_colors = dict(initial_node_colors)\n",
532533
" \n",
534+
" #Adding first node to the queue\n",
533535
" frontier.append(Node(problem.initial))\n",
534536
" \n",
535537
" node_colors[Node(problem.initial).state] = \"orange\"\n",
536538
" iterations += 1\n",
537539
" all_node_colors.append(dict(node_colors))\n",
538540
" \n",
539541
" while frontier:\n",
542+
" #Popping first node of queue\n",
540543
" node = frontier.pop()\n",
541544
" \n",
542545
" # modify the currently searching node to red\n",

0 commit comments

Comments
 (0)