def dfs(graph, start, visited=None):
if visited is None:
visited = set()
if start in visited:
return
visited.add(start)
for a in graph[start]:
if a not in visited:
dfs(graph, a, visited)
return visited
graph={'A':['B'],'B':['C']}
b=dfs(graph,'A')
print(b)
答案 0 :(得分:0)