Taroimo Science Lab日本語

All simulationsMenu

← All simulations

Graph 3-Coloring

Exaggerated displayPlay

Color the vertices with three colors so that no two vertices joined by an edge share a color. Paint and draw graphs yourself, or watch the computer step by step as it picks colors and backs up at dead ends, a method called backtracking. For university students, you can also check the reduction to learning 3-term DNF formulas.

  • With the "Paint" tool, tap a vertex to cycle its color red → blue → yellow → none. Drag a vertex to move it.
  • Set "Tool" to "Edit" to add a vertex by tapping empty space, and tap two vertices in turn to join them with an edge. If they are already joined, the edge is removed. With "Erase", a tapped vertex or edge is deleted.
  • Press "Solve by backtracking" to watch the computer set one vertex at a time and back up when stuck. "One step" advances one event at a time; "Solve at once" computes to the end immediately.
  • Change "Forward checking" and "Order of vertices" and compare how many colors were placed and how many times the search backed up.
  • Use "Choose a graph" to load a map, an exam timetable, graphs that cannot be 3-colored, and more. You can also make a random planar graph.
  • In "Reduction to 3-term DNF", check whether the logic formula built from the coloring is consistent with the set of examples built from the graph.