Amazon Robotics uses graph-like navigation models to represent reachable locations in a fulfillment center. Given an undirected or directed graph represented by an adjacency list, return the breadth-first traversal order starting from a specified node.
Your traversal must visit each reachable node at most once, preserve the neighbor order provided in the adjacency list, and safely handle cycles. If start is not present in the graph, return an empty list.
Implement traverse_graph(graph, start), where graph is a dictionary mapping a node to a list of neighboring nodes, and start is the node from which traversal begins. Return a list containing every node reachable from start in breadth-first order. A neighbor that does not appear as a key in graph is treated as a leaf node.
def traverse_graph(graph, start):