Connect nodes to maximize total edge weight

前端 未结 5 1130
情深已故
情深已故 2021-01-01 13:23

I am working on a problem which could be reduced to a graph optimization problem as below.

  • A set of colored nodes is given. They are all unconnected i.e. th

5条回答
  •  -上瘾入骨i
    2021-01-01 13:48

    Just an idea, didn't have much time to verify it.
    How about starting with a weighted graph G=(V,E) where V is your set of nodes and the weight E is the profit from your table. Let O be a empty set that will be our output.

    Then use a matching algorithm(Blossom algorithm) on G. Add these edges to O.

    Repeat the algorithm with input G'=(V,E\O). Again add these edges to O.

    Repeat another two times. Return O.

    Running time:
    Blossom algorithm's running time is O(E*V^(1/2)) according to wikipedia. Since the algorithm is used 4 times the overall running time would also be O(E*V^(1/2)).

提交回复
热议问题