def dfs_paths(graph, start):
    stack = [(iter([start]), [])]
    while stack:
        it, path = stack[-1]
        node = next(it, None)
        if node is None:
            stack.pop()
        elif node not in path:
            adj = graph[node]
            if adj:
                stack.append((iter(adj), path + [node]))
            else:
                yield path + [node]
dataset/ETHPy150Open bioinformed/vgraph/vgraph/graph.py/dfs_paths/original