KonkurStudy
همه کارت‌ها

Counting Proper Colorings via the Multiplication Principle

Color the cells/vertices in a dependency order; each new one has kk minus the number of already-colored neighbors choices, and you multiply.

کارت مفهوم کنکور ارشد علوم کامپیوتر

اهمیت
۰/۵

A proper coloring of a graph assigns a color to every vertex so that no edge joins two vertices of the same color. In konkur problems the "graph" is usually a figure of cells: each cell is a vertex, and two cells are adjacent (joined by an edge) when they share a side. The task is to count how many proper colorings exist with kk available colors.

The key idea is the multiplication principle: process the vertices in a carefully chosen order, and as you color each one, count how many colors are still legal given the choices already locked in. If those counts do not depend on the specific colors picked earlier — only on how many neighbors are already colored — the total is just the product of the per-vertex counts.

The per-vertex rule

Suppose you are about to color a vertex vv and exactly dd of its neighbors have already been colored. To stay proper, vv must avoid those neighbors' colors. In the cleanest case those dd neighbors carry dd distinct colors, so vv has

k−dlegal choices.k - d \quad\text{legal choices.}

Multiplying these counts down a good ordering gives the total number of proper colorings. Two especially common building blocks:

  • Pendant (degree-1) vertex. A cell whose only neighbor is colored last-but-one always sees exactly one forbidden color, so it contributes a factor of k−1k-1, no matter how the rest is colored. Strip pendants off and handle them as independent (k−1)(k-1) factors.
  • A path / tree of nn vertices. Color a root in kk ways, then each subsequent vertex has exactly one already-colored neighbor, contributing k−1k-1. A tree (no cycles) therefore has exactly k (k−1) n−1k\,(k-1)^{\,n-1} proper colorings.

How to apply

  1. Build the adjacency graph. Mark which cells share an edge; list the edges.
  2. Peel off pendants. Every degree-1 vertex multiplies the answer by (k−1)(k-1); remove it and repeat. This often shrinks the figure to a small core.
  3. Order the core so each new vertex has few colored neighbors. Color the first vertex in kk ways; for each later vertex subtract the number of distinctly-colored neighbors already placed.
  4. Multiply all the factors. Watch for vertices whose two colored neighbors might share a color (then the subtraction changes) — if so, split into cases.

Mini-example: a triangle with a tail

Take a triangle a-b-ca\text{-}b\text{-}c (each pair adjacent) plus a pendant cell dd attached only to cc, with k=3k=3 colors. Color aa: 33 ways. Color bb (neighbor aa): 3−1=23-1=2 ways. Color cc (neighbors a,ba,b, which are distinct): 3−2=13-2=1 way. Finally the pendant dd (one neighbor cc): 3−1=23-1=2 ways. The product is

3⋅2⋅1⋅2=123\cdot 2\cdot 1\cdot 2 = 12

proper colorings. The triangle forces all three colors, then the tail just avoids its single neighbor.

Exam trick: order matters only for counting, not for the figure — always color a vertex after enough of its neighbors so the choice count k−dk-d is forced and constant. If a vertex's already-colored neighbors could be either equal or different colors, do not write a single k−dk-d; split into cases (neighbors same vs. different) and add the resulting products.

فرمول‌های کلیدی

Greedy multiplication count
#colorings=∏v(k−d(v))\#\text{colorings}=\prod_{v}\bigl(k-d(v)\bigr)

Color vertices in an order where each $v$ has $d(v)$ distinctly-colored neighbors already placed; multiply the $k-d(v)$ legal choices.

Pendant (degree-1) factor
k−1k-1

A cell with a single neighbor always has $k-1$ legal colors regardless of the rest, so it splits off as an independent factor.

Proper colorings of a tree
k (k−1) n−1k\,(k-1)^{\,n-1}

Any tree (or path) on $n$ vertices: $k$ choices for the root, then $k-1$ for each of the remaining $n-1$ vertices.

#proper-coloring#graph-coloring#multiplication-principle#counting#pendant-vertex#chromatic#combinatorics#discrete-math

سوالات تمرینی