大きなサイズのバイナリ行列に対してC++でCCLを実装するにはどうすればよいですか?ウィキペディアでアルゴリズムを確認しましたが、それを解決する方法と、等価性を格納するためのデータ構造を実装する方法がわかりません。どんな助けでも大歓迎です
2 に答える
2
Mark all nodes unassigned.
Iterate through all nodes:
If node unassigned:
Assign node to a new component id C
Do a depth-first-search for all nodes connected to this one:
mark them with same component id C
于 2012-06-22T07:01:25.817 に答える
1
グラフを使用していない場合は、union-findデータ構造(disjoint-set data-strucutreとも呼ばれます)を利用します。
于 2012-06-22T07:03:18.027 に答える