📜  拓扑排序 - Python 代码示例

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

代码示例1
def topological_sort():
    for each node:
        if visited[node] is False:
            dfs(node)
def dfs(node):
    visited[node] = True
    for nei in neighbours[node]:
        dfs(node)
    ret.insert_at_the _front(node)