すべての可能な独立集合の中から最大値を見つける力ずくの方法以外に、2部グラフで最大の独立頂点集合を見つけるためのアルゴリズムは存在しないと思います。
考えられるすべての頂点セットを見つけるための擬似コードについて疑問に思っています。
4つの青い頂点と4つの赤い頂点を持つ2部グラフが与えられたとしましょう。現在私は
Start with an arbitrary blue,
find all red that don't match this blue
put all these red in Independent Set
find all blue that dont match these red
put these blue in Independent Set
Repeat for next vertex in blue
Repeat all over again for all blue then all vertices in red.
最初のステップの後、すべての可能性をステップスルーするのではなく、一致しない次の色の頂点をすべて選択するため、この方法ではすべての可能な独立集合の組み合わせが得られるわけではないことを理解しています。
たとえば、一致するグラフがあるとします
B R
1 1
1 3
2 1
2 3
3 1
3 3
4 2
4 4
Start with blue 1
Choose red 2 and 4 since they dont match
Add 2, 4 to independent Set
Choose 2 and 3 from blue since they dont with 2 or 4 from red
Add 2 and 3 from blue to independent set as well.
Independent Set = 1,2,3 from blue 2,4 from red
Repeat for blue 2, blue 3, ... red n (storing the cardinality for each set)
このアルゴリズムを改善して、すべての可能性をより適切に検索する方法はありますか?|2部グラフの最大セット| =|赤| +|青| -|最大マッチング|。
問題は、特定の青に対して最初にすべての可能な赤を選択することによって、それらの赤が他のすべての可能な青に接続する場合、私のセットにはすべて1つの青と残りの赤しか含まれない可能性があるために発生します。