In our graph dictionary, what are the keys and what are the values?
- A.Keys are numbers; values are strings
- B.Keys are (row, col) node tuples; values are lists of neighbor tuples
- C.Keys are lists; values are tuples
- D.Both are single integers
Answer Why?
Given graph = {(0,0): [(0,1)]}, what does (0,0) in graph return?
- A.True
- B.False
- C.[(0,1)]
- D.A KeyError
Answer Why?
In build_grid_graph, why is each neighbor guarded by an if (like `if row > 0`)?
- A.To make the code shorter
- B.To keep neighbors inside the grid — a corner or edge node has no neighbor off the grid
- C.To skip blocked nodes
- D.It has no effect
Answer Why?
To block node (1,1), what two things must happen to the graph dictionary?
- A.Just delete the key (1,1)
- B.Delete the key (1,1) AND remove (1,1) from every other node's neighbor list
- C.Set graph[(1,1)] to an empty list
- D.Nothing — blocked nodes are ignored automatically
Answer Why?