visualize Grid Components
Visualizes the strongly connected components (SCCs) of a Grid.
This function colors the tiles belonging to the same component with the same color.
Example usage:
val lines = listOf("ABC", "ABC")
val grid = Grid(lines)
grid.connectWithRule { t ->
grid.getStraightNeighbours(t).filter { it.data == t.data }
}
val scc = grid.stronglyConnectedComponents()
scc.visualizeGridComponents()Content copied to clipboard