Solving Graph Problems with Boolean Methods Randal E. Bryant Carnegie Mellon University.

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems Russell and Norvig: Chapter
Advertisements

Constraint Satisfaction Problems
22C:19 Discrete Math Graphs Fall 2010 Sukumar Ghosh.
Introduction to Graph Theory Instructor: Dr. Chaudhary Department of Computer Science Millersville University Reading Assignment Chapter 1.
22C:19 Discrete Math Graphs Fall 2014 Sukumar Ghosh.
BackTracking Algorithms
Great Theoretical Ideas in Computer Science for Some.
Lecture 24 Coping with NPC and Unsolvable problems. When a problem is unsolvable, that's generally very bad news: it means there is no general algorithm.
CompSci 102 Discrete Math for Computer Science April 19, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
9.2 The Traveling Salesman Problem. Let us return to the question of finding a cheapest possible cycle through all the given towns: We have n towns (points)
Great Theoretical Ideas in Computer Science.
Last time: terminology reminder w Simple graph Vertex = node Edge Degree Weight Neighbours Complete Dual Bipartite Planar Cycle Tree Path Circuit Components.
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
Constraint Satisfaction Problems
The Theory of NP-Completeness
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
Graph Colouring Lecture 20: Nov 25.
SAT Solving Presented by Avi Yadgar. The SAT Problem Given a Boolean formula, look for assignment A for such that.  A is a solution for. A partial assignment.
22C:19 Discrete Math Graphs Spring 2014 Sukumar Ghosh.
Chapter 9.8 Graph Coloring
CS 2813 Discrete Structures
Coloring 3/16/121. Flight Gates flights need gates, but times overlap. how many gates needed? 3/16/122.
9.8 Graph Coloring. Coloring Goal: Pick as few colors as possible so that two adjacent regions never have the same color. See handout.
Graph Coloring.
NP-Complete Problems CSC 331: Algorithm Analysis NP-Complete Problems.
Modeling Using Colorability Presented by: Kelley Louie CSC 252 Algorithms 252a-aj.
CS 200 Algorithms and Data Structures
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
Techniques for Proving NP-Completeness Show that a special case of the problem you are interested in is NP- complete. For example: The problem of finding.
Hande ÇAKIN IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Hard problems in computer science Prof. Noah Snavely CS1114
Chapter 10.8 Graph Coloring
1.5 Graph Theory. Graph Theory The Branch of mathematics in which graphs and networks are used to solve problems.
Graph Colouring Lecture 20: Nov 25. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including.
Some applications of graph theory
Homework - hints Problem 1. Node weights  Edge weights
Lecture 25 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
1 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
NPC.
Great Theoretical Ideas in Computer Science for Some.
Chapter 10.8 Graph Coloring These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7 th ed., by Kenneth.
Introduction to Graph & Network Theory Thinking About Networks: From Metabolism to the Genome to Social Conflict Summer Workshop for Teachers June 27 th.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
Homework 8 Graph G is given by the figure below.
EMIS 8373: Integer Programming
Richard Anderson Lectures NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
Redraw these graphs so that none of the line intersect except at the vertices B C D E F G H.
Lecture 2-2 NP Class.
Great Theoretical Ideas In Computer Science
Richard Anderson Lecture 26 NP-Completeness
Graph theory Definitions Trees, cycles, directed graphs.
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
EECS 203 Lecture 20 More Graphs.
Great Theoretical Ideas in Computer Science
Lecture 5 NP Class.
Discrete Mathematics for Computer Science
Lecture 24 NP-Complete Problems
ICS 353: Design and Analysis of Algorithms
Graphs Chapter 13.
Richard Anderson Lecture 25 NP-Completeness
Chapter 10.8 Graph Coloring
Chapter 10.8 Graph Coloring
Chapter 10.8 Graph Coloring
Constraint satisfaction problems
Chapter 10.8 Graph Coloring
Our old list of problems
Constraint satisfaction problems
Presentation transcript:

Solving Graph Problems with Boolean Methods Randal E. Bryant Carnegie Mellon University

The Graph Coloring Problem Color the regions of a planar graph Use only 4 colors No two adjacent regions can have the same color Example: Color the states of a U.S. map

The MacGregor Graph Scientific American, April 1975 Said to be proof that some planar graphs could not be colored with just 4 colors An April-fool’s joke, but still difficult to solve by hand

Boolean SAT Solvers What They Do Express problem as a set of constraints Search for solution that satisfies all constraints Encoding Graph Coloring with SAT Encode each region with two 0/1-valued variables: 00Blue 01Green 10Red 11Yellow For each adjacent region, require at least one of the corresponding variables to have opposite values

Encoding Coloring Constraints Encode region i with variables a i, b i For adjacent regions i and j, want: a i ≠ a j  b i ≠ b j Clausal form (and of or’s): (c  a i  a j )  (c   a i   a j )  (  c  b i  b j )  (  c   b i   b j ) a i, b i a j, b j c = 0  a i ≠ a j c = 1  b i ≠ b j

The ZChaff SAT Solver From Princeton University Algorithm by Davis Putnam Logemann & Loveland With many refinements Based on backtracking search Try assigning values to variables When hit contradiction Create new constraint encoding conflict Backtrack by undoing some of the most recent assignments Resume search with new variable assignments

Visualizing the Search Process Black: Neither variable assigned value Single color: Both variables assigned, giving unique color. Blended colors: One variable assigned, the other unassigned, indicating two possible colors YouTube:

The Final Result

Another Solution Minimum use of greeen (7 times)

Try It Yourself Color the rest of the map using 3 colors

Minimum Colorings of US Map Only need to use green twice

Odd Cycles Can this be colored with just 3 colors?

Odd Cycles in US Map

Overlapping Odd Cycles

Breaking Odd Cycles

Viewing Maps as Graphs 48 nodes 105 edges

Coloring a Graph

The Macgregor Graph 110 nodes 324 edges

The Four Color Theorem Can color any planar graph with just 4 colors.History Conjectured in : it was shown that 5 colors would suffice 1976: Appel & Haken claimed they had proof

Proof of Four Color Theorem Proof Method Appel & Haaken showed there were 1,936 graphs that covered all possibities Wrote computer program to check all of themReaction Many mathematicians didn’t like this kind of proof Program has been rewritten and rechecked multiple times, and so the proof is generally accepted.

Coloring Other Graph Types Sphere: same as plane Plane  sphere Reduce exterior edges to points Sphere  plane Cut hole and stretch out flat

Coloring A Torus Torus 7 colors necessary 7 regions, each with 6 neighbors Also sufficient

Torus: An Infinite Wallpaper Pattern

Sudoku as a Graph Coloring Problem

Adding Colors

Taking Away Numbers

Graph Structure of Sudoku X 4 SudokuColumn constraints

Graph Structure of Sudoku X 4 SudokuRow constraints

Graph Structure of Sudoku X 4 SudokuBlock constraints

Graph Structure of Sudoku X 4 Sudoku 16 nodes All constraints 56 edges 9 x 9 Sudoku: 81 nodes, 810 edges

Visualizing Solution Process

Solving A Sudoku Puzzle

Touring the US

Weighted US Graph Shortest driving distances between capitol cities Staying within source and destination states Computed by Don Knuth using Mapquest

A Capitol Tour A Hamiltonian Path 15,136 miles (24,359 km) total 68,656,026 possible tours

Limiting Node Degree

A Spanning Tree

The Shortest Capitol Tour 11,698 miles (18,826 km) total A Traveling Salesman Path

The Longest Capitol Tour 18,040 miles (29,033 km) total

Two Interesting Capitol Tours

3 time changes19 time changes

Touring MacGregor A Hamiltonian Cycle

Lessons Learned Graph Coloring Maps are a kind of graph Sudoku is a graph coloring problem Hamiltonian Paths Find a path in graph that goes through every node once Considered a difficult problem Boolean Methods Can encode wide variety of graph problems Can find solution using SAT solver In worst case, has exponential performance But gets solution for many interesting problems