题目
A cycle tree is a connected undirected graph that respects one of the following:
It’s an elementary cycle of length greater than or equal to 3.
It’s a graph resulted by attaching an elementary cycle to another cycle tree. Attaching a cycle means choosing two edges, one from the cycle and the other one from the cycle tree, and merging them and their incident nodes:
You are give a cycle tree, compute its maximum independent set.
1<=n<=50000,1<=m<=100000
解法
找到一个度数为2的点,然后删掉它以及相连的两条边,并在它的两个邻居之间连一条虚边(如果不存在实边),接着重复以上过程直到最后只剩下一条边
删掉一个点的时候,我们称它相连的两条边是它邻居之间的那条边的子边
那么边的关系就变成了一棵树
然后就可以DP了,设f[edge][flag1][flag2]表示对于一条边(可能是虚边也可能是实边)表示左边点和右边点分别选不选的最大独立集大小
转移的时候就只用考虑三个点的关系就好了