Zemoso Technologies models service dependencies and workflow transitions as a directed graph. Given an adjacency-list representation and a starting service, return the nodes reachable from that service in both depth-first search and breadth-first search order.
Implement both traversals in one function. A node must appear at most once in each result, and when multiple unvisited neighbors are available, process them in the order listed in the adjacency list. The DFS result must use iterative depth-first search, so it does not depend on Python recursion depth.
graph, a dictionary mapping each string node to a list of neighboring string nodes, and start, a string contained in graph."dfs" and "bfs". Each value is a list of node names in the corresponding traversal order.start.def traverse_graph(graph, start):