Checking a Graph with Two Colors
A graph is bipartite when vertices can be assigned one of two parts and every edge crosses between the parts.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Color a short chain
In A–B–C–D, assigning A and C to the first part and B and D to the second works. Adding A–D still crosses the parts. Undirected connections require both ends of each edge to be examined consistently.
Find an odd cycle obstruction
On a triangle, A and B must differ and B and C must differ, forcing A and C to agree despite their edge. See cycle witnesses for reporting that specific obstruction.[1]
Propagate alternating colors and inspect contradictions
In square A–B–C–D–A, color A blue. Its neighbors B and D must be gold, which forces C to be blue. Adding diagonal A–C makes two adjacent vertices share blue under the forced assignments. See connected components.
A blue → B gold → C blue
D gold meets both C and A
A–C check with added diagonal: blue versus blue → conflict
Start again in each uncolored component
An isolated vertex can receive either color. An odd cycle cannot be colored because alternating along it forces opposite colors for the start on return. An undirected self-loop also gives an immediate conflict. Test both valid and conflicting components together.