获得树的最小顶点覆盖率的好的算法是什么? [英] What is a good algorithm for getting the minimum vertex cover of a tree?

查看:54
本文介绍了获得树的最小顶点覆盖率的好的算法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是获取树的最小顶点覆盖率的好算法?

What is a good algorithm for getting the minimum vertex cover of a tree?

节点的邻居.

最小顶点数.

推荐答案

我希望

I hope here you can find more related answer to your question.

我正在考虑我的解决方案,可能您需要完善它,但是只要动态编程位于您的标签之一中,您可能就需要:

I was thinking about my solution, probably you will need to polish it but as long as dynamic programing is in one of your tags you probably need to:

  1. 对于每个u顶点,定义S +(u)为顶点u和S-(u)的覆盖大小覆盖没有顶点u.
  2. S +(u)= 1 +每个u的子v的和(S-(v)).
  3. S-(u)=每个u的孩子v的总和(max {S-(v),S +(v)}).
  4. 答案是max(S +(r),S-(r)),其中r是树的根.


阅读之后.更改了上述算法,以找到最大独立集,因为在Wiki文章中指出


After reading this. Changed the above algorithm to find maximum independent set, since in wiki article stated

当且仅当补集是顶点覆盖时,集合才是独立的.

A set is independent if and only if its complement is a vertex cover.

因此,通过将min更改为max,我们可以找到最大的独立集,并称赞最小的顶点覆盖,因为这两个问题是等价的.

So by changing min to max we can find the maximum independent set and by compliment the minimum vertex cover, since both problem are equivalent.

这篇关于获得树的最小顶点覆盖率的好的算法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆