📜  python 中图形使用集和哈希的表示 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:14.604000             🧑  作者: Mango

代码示例1
def find_path(graph, start, end, path=[]):
        path = path + [start]
        if start == end:
            return path
        if not graph.has_key(start):
            return None
        for node in graph[start]:
            if node not in path:
                newpath = find_path(graph, node, end, path)
                if newpath: return newpath
        return None