質問

I have a disconnected bipartite undirected graph. I want to completely disconnect the graph. Only operation that I can perform is to remove a node. Removing a node will automatically delete its edges. Task is to minimize the number of nodes to be removed. Each node in the graph has atmost 4 edges.

By completely disconnecting a graph, I mean that no two nodes should be connected through a link. Basically an empty edge set.

役に立ちましたか?

解決

I think, you cannot prove your algorithm is optimal because, in fact, it is not optimal.

To completely disconnect your graph minimizing the number of nodes to be removed, you have to remove all the nodes belonging to the minimal vertex cover of your graph. Searching the minimal vertex cover is usually NP-complete, but for bipartite graphs there is a polynomial-time solution.

Find maximum matching in the graph (probably with Hopcroft–Karp algorithm). Then use König's theorem to get the minimal vertex cover:

Consider a bipartite graph where the vertices are partitioned into left (L) and right (R) sets. Suppose there is a maximum matching which partitions the edges into those used in the matching (E_m) and those not (E_0). Let T consist of all unmatched vertices from L, as well as all vertices reachable from those by going left-to-right along edges from E_0 and right-to-left along edges from E_m. This essentially means that for each unmatched vertex in L, we add into T all vertices that occur in a path alternating between edges from E_0 and E_m.

Then (L \ T) OR (R AND T) is a minimum vertex cover.

他のヒント

Here's a counter-example to your suggested algorithm.

enter image description here

The best solution is to remove both nodes A and B, even though they are different colors.

Since all the edges are from one set to another, find these two sets using say BFS and coloring using 2 colours. Then remove the nodes in smaller set.

Since there are no edges among themselves the rest of the nodes are disconnected as well.

[As a pre-processing step you can leave out nodes with 0 edges first.]

I have thought of an algorithm for it but am not able to prove if its optimal.

My algorithm: On each disconnected subgraph, I run a BFS and color it accordingly. Then I identify the number of nodes colored with each color and take the minimum of the two and store. I repeat the procedure for each subgraph and add up to get the required minimum. Help me prove the algorithm if it's correct.

EDIT: The above algorithm is not optimal. The accepted answer has been verified to be correct.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top