Algorithm to find lowest common ancestor in directed acyclic graph?

后端 未结 10 888
孤独总比滥情好
孤独总比滥情好 2020-12-02 11:34

Imagine a directed acyclic graph as follows, where:

  • \"A\" is the root (there is always exactly one root)
  • each node knows its parent(s)
  • the no
10条回答
  •  南方客
    南方客 (楼主)
    2020-12-02 11:56

    I was looking for a solution to the same problem and I found a solution in the following paper:

    http://dx.doi.org/10.1016/j.ipl.2010.02.014

    In short, you are not looking for the lowest common ancestor, but for the lowest SINGLE common ancestor, which they define in this paper.

提交回复
热议问题