Your question is Breadth-First Search Implementation. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Unity tooling can model scene, prefab, and asset dependencies as a directed graph. Given an adjacency-list representation and a starting asset, return the nodes visited by a breadth-first search, preserving the neighbor order provided in the input.
Implement bfs_graph(graph, start).
graph is a dictionary where each key is a node identifier and its value is a list of directly reachable node identifiers.start is a node identifier. It may be omitted from graph, in which case it has no outgoing edges.start, in BFS order.def bfs_graph(graph, start):