def recursive_dfs(graph, start, path=[]):
  '''recursive depth first search from start'''
  path=path+[start]
  for node in graph[start]:
    if not node in path:
      path=recursive_dfs(graph, node, path)
  return path
recursive depth first search from start
recipes/Python/576723_dfs_and_bfs_graph_traversal/recipe-576723.py