Four-Neighbor and Eight-Neighbor Grids
Different adjacency rules define which neighboring pixels can connect. Some include diagonals, and others use only horizontal and vertical steps.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Trace two selected cells
Pixels at row zero column zero and row one column one touch diagonally. They are connected directly under eight-neighbor adjacency and separate under four-neighbor adjacency if no other cells are selected. See grids as graphs.
State the convention with results
Component counts depend on this choice. Test a diagonal pair so the code's selected rule is visible. Connected components supply the graph interpretation.[1][2]