Your question is Tree or Graph Traversal. 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.
EOG engineers model dependencies between well assets as a directed graph. Given an asset dependency graph and a starting asset, return the assets reachable from the start in breadth-first search order.
Each graph key identifies an asset, and its value is a list of directly dependent assets. Visit neighbors in the order they appear in each list. An asset must appear at most once, including when the graph contains cycles. If the starting asset has no outgoing edges, return a list containing only that asset.
Implement traverse_assets(graph, start).
graph is a dictionary mapping strings to lists of strings.start is a string identifying the starting asset and is guaranteed to exist in graph.start, in BFS order.def traverse_assets(graph, start):