【发布时间】:2012-06-22 06:33:30
【问题描述】:
如何在 C++ 中为大尺寸的二进制矩阵实现 CCL?我已经检查了维基百科中的算法,但我不明白如何解决它并实现数据结构来存储等价!任何帮助将不胜感激
【问题讨论】:
-
我正在尝试为算法编写伪代码,并使用一个额外的矩阵进行标记
标签: c++ c algorithm graphics matrix
如何在 C++ 中为大尺寸的二进制矩阵实现 CCL?我已经检查了维基百科中的算法,但我不明白如何解决它并实现数据结构来存储等价!任何帮助将不胜感激
【问题讨论】:
标签: c++ c algorithm graphics matrix
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
【讨论】:
如果您不使用图表,请利用联合查找数据结构(也称为不相交集数据结构)
【讨论】: