Graph Coloring Calculator

χ(G) = minimum colors

CalculatorsFreeNo Signup
4.9(742 reviews)
All Tools

Loading tool...

About Graph Coloring Calculator

A graph coloring calculator finding the chromatic number χ(G) (minimum colors for proper vertex coloring) and the chromatic polynomial P(G,k) counting proper k-colorings. Supports common graph families and custom edge lists. Client-side.

Graph Coloring Calculator Features

  • Chromatic number
  • Chromatic polynomial
  • Proper coloring
  • Graph families
  • Four color theorem
Graph coloring: assign colors to vertices so no adjacent vertices share a color. χ(G) = minimum colors needed. Four Color Theorem: χ(G) ≤ 4 for all planar graphs. P(G,k) = chromatic polynomial counts k-colorings. P(K_n,k) = k(k-1)(k-2)...(k-n+1). NP-hard in general.

How to Use

Define graph edges:

  • χ(G): Minimum colors
  • P(G,k): Chromatic polynomial
  • Coloring: Valid assignment

Four Color Theorem

Every planar graph can be properly colored with ≤4 colors. Proven 1976 by Appel & Haken using computer-assisted proof (first of its kind). Still no human-only proof exists. 5 colors is easy to prove; 4 is the hard part.

Complexity

Finding χ(G) is NP-hard. Even deciding if χ(G)≤3 is NP-complete. Greedy coloring uses ≤Δ(G)+1 colors (Brook's theorem: ≤Δ unless complete or odd cycle). For planar: always ≤4 (Four Color Theorem).

Step-by-Step Instructions

  1. 1Define edges.
  2. 2Compute χ(G).
  3. 3Find coloring.
  4. 4Compute polynomial.
  5. 5Verify properness.

Graph Coloring Calculator — Frequently Asked Questions

What is the Four Color Theorem?+

Every map (planar graph) can be colored with at most 4 colors so that adjacent regions have different colors. Proven in 1976 by Appel and Haken — the first major theorem proved using computers. It required checking ~1500 configurations.

How hard is graph coloring?+

NP-hard in general! Even deciding '3-colorable?' is NP-complete. No polynomial algorithm is known unless P=NP. But special cases are easy: bipartite graphs need 2 colors, trees need 2, planar graphs need ≤4.

What's the chromatic polynomial?+

P(G,k) counts the number of proper k-colorings of G. It's always a polynomial in k of degree n (# vertices). For the empty graph: k^n. For K_n: k!/(k-n)! = falling factorial. Deletion-contraction computes it.

Share this tool: