DFS,拓扑排序

DFS伪代码:

DFS(G,s)
    for each vertex v in V(G)
        status[v] = WHITE
        /******其他初始化******/
    for each vertex v in V(G)
        if(status[v]==WHITE)
            DFS-VISIT(v)
 
DFS-VISIT(v)
    status[v] = GRAY
    for each vertex t in Adj(v)
        if status[t] = WHITE
            DFS-VISIT(t)
            /******其他操作******/
    status[v] = BLACK

关于DFS的C语言版和拓扑排序以及是否存在环,引用一位大牛的博客:


http://blog.csdn.net/acceptedxukai/article/details/6959882

相关文章
相关标签/搜索