AKUNA CAPITAL models relationships between trading components as a directed dependency graph. An edge A -> B means component A must be processed before component B.
Implement has_cycle(graph) to determine whether the directed graph contains a cycle. A cycle means that no valid processing order exists because at least one component depends, directly or indirectly, on itself.
graph: a dictionary mapping each component name to a list of components it directly depends on.True if the graph contains at least one directed cycle; otherwise return False.def has_cycle(graph):