Find Isolated Pixels in Grid
find_isolated_pixels.RdScans the grid to find black pixels that have no black neighbors, which violates the connectivity requirement for DLA simulations.
Value
List of isolated pixel positions (each element is a 2-element numeric vector with row and column indices). Returns empty list if no isolated pixels found.
Details
This function is useful for:
Debugging WebR/Shiny reactive timing issues
Validating grid state after async simulations
Testing grid connectivity requirements
A pixel is considered isolated if:
It is black (value = 1)
None of its neighbors (in the specified neighborhood) are black
Note: The center pixel is never considered isolated (it's the seed).
Examples
grid <- initialize_grid(10)
#> INFO [2026-02-03 16:36:04] Initializing grid of size 10x10
grid[3, 3] <- 1 # Add isolated pixel far from center
isolated <- find_isolated_pixels(grid, "4-hood")
#> WARN [2026-02-03 16:36:04] Grid has 2 isolated pixel(s)
length(isolated) # Should be 1
#> [1] 2