Your question is Graph Traversal for Networks. 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.
Altana's supply chain graph represents entities such as suppliers, manufacturers, and logistics hubs as nodes, with directed relationships as edges. Given this graph, return the shortest path from a starting entity to a target entity using breadth-first search.
If the target cannot be reached, return an empty list. The path must include both the start and target nodes. Neighbor lists should be processed in the order provided, so the returned path is deterministic when multiple shortest paths exist.
Implement find_shortest_path(graph, start, target), where graph is a dictionary mapping strings to lists of neighboring entity IDs. Return a list of strings representing the shortest directed path, or [] when no path exists.
def find_shortest_path(graph, start, target):