The definition might lead one to apply a standard connected component labeler to the subgraph in the 3 ×3
neighborhood of (x, y) once (x, y) is removed. However, given the size of the graph, a faster method involves
using a look-up table. The binary values of the eight neighbors of (x, y) can be encoded in an 8-bit index for
the table. Of course, the table has 256 elements. The bit assignments are bi for 0 ≤ i ≤ 7 are shown below: