Efficient algorithm for merging two DAGs

前端 未结 3 1665

I have two weighted DAGs (directed acyclic graphs) and need to merge them into one, so I can get a topological ordering (it could be more than two in some cases). The problem is

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-05 20:51

    One issue is that there is may be more than one solution.

    Consider for instance the DAGs {(a,b),(a,c)} and {(b,a),(b,c)}. You can "merge" these in two different ways:

    1. {(a,b),(a,c),(b,c)}
    2. {(a,c),(b,a),(b,c)}

    The number of solutions grows combinatorially with the number of cycles in the union of the two graphs, so for your big graphs there is probably a huge number of ways you can "merge" them.

    Do you have a criterion which could help you decide which DAG is "better" than another?

提交回复
热议问题