拓扑排序:图表

时间:2018-06-01 09:15:22

标签: directed-acyclic-graphs topological-sort

我看了一个关于topological ordering的类似问题,但仍不确定这个概念。

我不确定这些问题。

Assuming the DFS visits adjacent nodes in alphabetical order, nd a topological order of
the nodes v 2 V by running the DFS on this DAG G from the source (zero in-degree)
node.

Graph

对于以下内容,我得到了(a,d,c,e,b,f)的拓扑顺序。这是正确的拓扑排序吗?

1 个答案:

答案 0 :(得分:0)

对于拓扑排序,可以有多个correct排序,而您拥有的排序是正确的。要记住的是for every directed edge uv from vertex u to vertex v, u comes before v in the ordering所以在你的图表中,考虑边缘a-> c(必须在c之前)c-> e(c必须在e之前)e-> f (e必须在f之前出现)等等。