0

如何在 C++ 中为大尺寸的二进制矩阵实现 CCL?我已经检查了维基百科中的算法,但我不明白如何解决它并实现数据结构来存储等价!任何帮助将不胜感激

4

2 回答 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

如果您不使用图形,请利用联合查找数据结构(也称为不相交集数据结构)

于 2012-06-22T07:03:18.027 回答