Implement an efficient algorithm to detect cycles in a directed graph representing workflow dependencies for Qventus. Represent the graph as a dictionary mapping each workflow step to a list of dependent steps, and return True if any directed cycle exists, otherwise return False. Implement has_cycle(graph), where nodes may appear only in dependency lists and the graph may contain disconnected components.
def has_cycle(graph):