Tencent Cloud TKE services may depend on other services during deployment. Given a directed dependency graph, determine whether any circular dependency exists.
A directed edge A -> B means service A depends on service B. Return true if the graph contains a directed cycle, otherwise return false.
Implement has_cycle(dependencies), where dependencies is a dictionary mapping each service name to a list of services it directly depends on. Service names are non-empty strings. A dependency may reference a service that does not appear as a dictionary key, and such a service should be treated as having no outgoing edges.
The graph can be disconnected. Self-dependencies count as cycles.
def has_cycle(dependencies):