Hoshen–Kopelman algorithm: Difference between revisions

Content deleted Content added
Changed 4x4 neighborhood to 4-connected neighborhood
Pseudocode: Possible mistake
Line 33:
for y in 0 to n_rows {
if occupied[x, y] then
left = occupied[x-1, y]; # Shouldn't this be label[x-1, y]
above = occupied[x, y-1]; # Same here?
if (left == 0) and (above == 0) then /* Neither a label above nor to the left. */
largest_label = largest_label + 1; /* Make a new, as-yet-unused cluster label. */