2-SAT
Convert two-literal clauses into implications, group them by SCC, and derive a satisfying assignment.
Core idea
Clause a or b is equivalent to two implications: not a implies b, and not b implies a. Strongly connected components expose contradictions and provide an assignment order.
Read the visualization
Each variable appears as two literal vertices. Clause edges arrive in pairs, SCC colors group mutual implications, and the final badges show the selected truth values.
Create one implication-graph vertex for every literal and its negation.
Complexity and tradeoffs
Time: O(V+E). Space: O(V+E). A formula is impossible exactly when a variable and its negation share one strongly connected component.
Where it fits
2-SAT models pairwise choices, scheduling exclusions, orientation constraints, and configuration flags. Clauses with three or more unrestricted literals make the general problem NP-complete.