Longest acyclic path in a directed unweighted graph

后端 未结 4 1129
借酒劲吻你
借酒劲吻你 2020-11-29 06:13

What algorithm can be used to find the longest path in an unweighted directed acyclic graph?

4条回答
  •  庸人自扰
    2020-11-29 06:42

    Can be solved by critical path method:
    1. find a topological ordering
    2. find the critical path
    see [Horowitz 1995], Fundamentals of Data Structures in C++, Computer Science Press, New York.

    Greedy strategy(e.g. Dijkstra) will not work, no matter:1. use "max" instead of "min" 2. convert positive weights to negative 3. give a very large number M and use M-w as weight.

提交回复
热议问题