algorithm - 完全断开二分图

标签 algorithm graph graph-theory graph-algorithm bipartite

我有一个断开连接的二分无向图。我想完全断开图形。我可以执行的唯一操作是删除一个节点。移除一个节点会自动删除它的边。任务是最小化要删除的节点数。图中的每个节点最多有 4 条边。

通过完全断开图,我的意思是任何两个节点都不应通过链接连接。基本上是一个空边集。

最佳答案

我认为,你不能证明你的算法是最优的,因为事实上它不是最优的。

要完全断开你的图,最大限度地减少要删除的节点数,你必须删除属于你的图的最小顶点覆盖的所有节点。搜索最小顶点覆盖通常是 NP 完全的,但对于二部图,存在多项式时间解决方案。

在图中找到最大匹配(可能使用 Hopcroft–Karp algorithm )。然后使用 König's theorem获得最小的顶点覆盖:

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.

关于algorithm - 完全断开二分图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11834881/

相关文章:

c++ - 如何通过交换边使图强连通

c# - 图中2个节点之间的所有路径

algorithm - 从不同的角度构建装饰品的方法。彩珠(图论算法)

algorithm - 简化 Z = X ^ (X << Y) 函数的反函数

c - N皇后使用回溯的时间复杂度?

algorithm - 如何定义随机搜索问题的完备性?

r - 排列矩阵 - 网络图

python - 带条件的最短路径图搜索

python - 查找图中所有不存在的连接

algorithm - 递归计算支配树的有效方法?