Skip to content
BetterDL

Adjacent cells

Also called: K-map adjacency, adjacent K-map cells, neighboring cells, logically adjacent cells, logical adjacency

Two K-map cells are adjacent when their input codes differ in exactly one variable. Only adjacent cells can be grouped together.

Two cells on a K-map are adjacent when their codes differ in exactly one variable, the same idea as adjacent minterms. Only adjacent cells can share a group, because only then does a variable cancel.

On the map, adjacency looks like this:

  • side by side in a row, or directly above or below: adjacent
  • at opposite ends of a row or column: adjacent, because the map wraps
  • touching only at a corner (diagonal): never adjacent

In an n-variable map every cell has exactly n neighbors, one for each variable you could flip. In a 4-variable map that's 4 neighbors, including any across a wrap.

A quick test without the map: two cells are adjacent if their codes have a hamming distance of 1. Equivalently, XORing the two minterm numbers gives a power of two: 5 ⊕ 7 = 2 (adjacent), but 3 ⊕ 5 = 6 (not adjacent).

Consecutive minterm numbers are often not adjacent. m7 = 0111 and m8 = 1000 differ in all four bits, even though 7 and 8 are next to each other as numbers.

AB\CD00011110
00
0m0
1m1
0m3
0m2
01
1m4
0m5
1m7
0m6
11
0m12
1m13
0m15
0m14
10
0m8
0m9
0m11
0m10

Worked examples

Example

The neighbors of m5

The map above marks every neighbor of m5 (0101), the second cell of the second row.

  1. 1.

    Flip A: 1101 = m13, directly below.

  2. 2.

    Flip B: 0001 = m1, directly above.

  3. 3.

    Flip C: 0111 = m7, to the right.

  4. 4.

    Flip D: 0100 = m4, to the left.

  5. 5.

    Four neighbors in a 4-variable map. ✓

Example

The neighbors of m8

Find every cell adjacent to m8 (1000, bottom-left corner).

  1. 1.

    Flip A: 0000 = m0, at the top of the same column (wrap).

  2. 2.

    Flip B: 1100 = m12, directly above.

  3. 3.

    Flip C: 1010 = m10, at the far right of the same row (wrap).

  4. 4.

    Flip D: 1001 = m9, to the right.

Common mistakes

  • Treating diagonal cells as adjacent. They differ in two variables.

  • Assuming consecutive numbers are neighbors. m3 and m4 differ in three bits.

  • Ignoring the wrap, which makes end cells of a row or column adjacent.

Practice Adjacent cells

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Adjacent cells is taught in Karnaugh Maps.