Complete the following `traversal` function, which uses\n`frontier` and `visited` data structures to perform a\n**depth first traversal** of a graph (ie. **adjacency list**):

\ndef traversal(graph: dict[str, list[str]], source: str) -> None:\n ____ = [source] # 1.\n ____ = set() # 2.\n\n while ____: # 3.\n vertex = ____ # 4.\n\n if vertex in ____: # 5.\n continue\n\n ____ # 6.\n\n print(vertex)\n\n for neighbor in ____: # 7.\n ____ # 8.\n\n" }, "q2": { "type": "multiple", "question": "\n

Given the `traversal` function above and the `frontier`\ndata structure used during traversal, which of the following statements\nregarding **depth first search**, **breadth first search**,\n**Dijkstra's algorithm**, and **Prim's algorithm** are true (select\nall that apply)?

Given the graph below, which of the following traverals is a valid\n**depth first search** starting from vertex `A` (select all that\napply).

\n \n

\n",
"responses": {
"a": "Given the same graph above, which of the following traverals is a valid\n**breadth first search** starting from vertex `A` (select all\nthat apply).

Given the same graph above, which of the following statements regarding\nthe **shortest path** between `A` and `C` are true (select\nall that apply)?\n",
"responses": {
"sssp_path_ac": "The **shortest path** between `A` and ` is A, C.",
"sssp_path_abdc": "The shortest path between A and is A, B, D, C.",
"sssp_distance_6": "The shortest path between A and has a distance of 6.",
"sssp_distance_5": "The shortest path between A and has a distance of 5."
}
},
"q6": {
"type": "multiple",
"question": "\n`

Given the same graph above, which of the following statements regarding\nthe **minimum spanning tree** of the graph (assuming all edges are\n**undirected**) are true (select all that apply)?\n",
"responses": {
"mst_ab": "The **minimum spanning tree** includes the edge `A, B`.",
"mst_ac": "The **minimum spanning tree** includes the edge `A, C`.",
"mst_bc": "The **minimum spanning tree** includes the edge `B, C`.",
"mst_bd": "The **minimum spanning tree** includes the edge `B, D`.",
"mst_cd": "The **minimum spanning tree** includes the edge `C, D`."
}
}
}