graph theory - carnegie mellon school of computer sciencekcordwel/graphtheoryandcoloring.pdfgraph...

67
Graph Theory Katherine and Noam

Upload: others

Post on 23-Sep-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Graph TheoryKatherine and Noam

Page 2: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

The Seven Bridges of Königsberg

Page 3: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

The Seven Bridges of Königsberg

● Königsberg is a city in Russia● It is separated by several rivers, and there are bridges

over these rivers

Image credit: Bogdan Giuşcă - Public domain (PD), based on the image, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=112920

Page 4: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

The Seven Bridges of Königsberg

● Is there a way to cross each of these bridges exactly once?

Page 5: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

The Seven Bridges of Königsberg: Activity!

● Is there a way to cross each of these bridges exactly once?

● Try it!

Page 6: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

The Seven Bridges of Königsberg

● Is there a way to cross each of these bridges exactly once? NO!

Page 7: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

The Seven Bridges of Königsberg

● Is there a way to cross each of these bridges exactly once? NO!

● How can we understand this mathematically?

Page 8: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Rephrase the problem!

● Let’s think of each land mass as a point● Think of the bridges as edges between the points

Image credit: https://physics.weber.edu/carroll/honors/konigsberg.htm

Page 9: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Graph theory!

● This kind of representation of our problem is a graph.

Image credit: Wikipedia

Page 10: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Wait, what’s a graph?

Page 11: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

What is a graph?

● Sometimes when people say “graph”, they mean something like this or this:

Image credit: https://www.podfeet.com/blog/tutorials-5/how-to-make-2d-excel-graphs-look-3d/, http://csas.ei.columbia.edu/2016/09/26/a-better-graph/

Page 12: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

What is a graph?

● But often, mathematicians mean something like this or this:

Image credit: https://www.maths.unsw.edu.au/about/graph-theory-unsw-past-and-present, Wikipedia

Page 13: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

What is a graph?

● More formally, a graph is just a set of points (vertices) and edges connecting those points.

● The points can be labeled (but don’t have to be)

Page 14: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Graphs in the real world

Page 15: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Eulerian Paths

Page 16: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Eulerian Path

● An Eulerian path is a path through a graph that travels through each edge exactly once.

Page 17: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Eulerian Path

● An Eulerian path is a path through a graph that travels through each edge exactly once.

● The Bridges of Königsberg is really asking whether we can find an Eulerian path through this graph.

Page 18: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Eulerian Path: Activity!

● An Eulerian path is a path through a graph that travels through each edge exactly once.

● Let’s understand when we can and can’t find an Eulerian path through a graph.

Page 19: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Eulerian Path Recap

● If we have an Eulerian path, what vertices can have an odd number of edges coming from them?

○ The start vertex○ The end vertex

Page 20: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Planar Graphs

Page 21: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Graph theory

● Question: What information determines a graph?

Page 22: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Graph theory

● Question: What information determines a graph?● Answer: Just the vertices (points) and the edges (connections

between points). Nothing else matters!

Page 23: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Graph theory

● Question: What information determines a graph?● Answer: Just the vertices (points) and the edges (connections

between points). Nothing else matters!

Are these the same graph?

Page 24: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Graph theory

● Question: What information determines a graph?● Answer: Just the vertices (points) and the edges (connections

between points). Nothing else matters!

What about these?

Page 25: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Graph theory

● These look really different, but are all the same graph

Image credit: http://mathworld.wolfram.com/PetersenGraph.html

Page 26: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Planar graphs

● If we can draw a graph without its edges crossing, then the graph is planar

Page 27: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Planar graphs

● If we can draw a graph without its edges crossing, then the graph is planar

● Example:

Image credit: http://www.personal.kent.edu/~rmuhamma/GraphTheory/MyGraphTheory/planarity.htm

Page 28: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Planar graphs

● If we can draw a graph without its edges crossing, then the graph is planar

● Example:

The edges are crossing right now, but can we redraw it?

Image credit: http://www.personal.kent.edu/~rmuhamma/GraphTheory/MyGraphTheory/planarity.htm

Page 29: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Planar graphs

● If we can draw a graph without its edges crossing, then the graph is planar

● Example:

Image credit: http://www.personal.kent.edu/~rmuhamma/GraphTheory/MyGraphTheory/planarity.htm

Page 30: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Planar graphs

● If we can draw a graph without its edges crossing, then the graph is planar

● Now you try!

Image credit: http://www.personal.kent.edu/~rmuhamma/GraphTheory/MyGraphTheory/planarity.htm

Page 31: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Graph Theory and Coloring

Page 32: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Map Coloring

Fill in every region so that no two adjacent regions have the same color.

Page 33: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

How many colors would it take to color this map?

Page 34: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

You can do it with four!

Image credit: Wikipedia

Page 35: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Now, challenge each other...

Pair up, and make a challenge map for your partner that you think should require many colors.

Then switch maps and try to color your partner’s challenge map with as few colors as possible!

Page 36: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

The Four Color Theorem

Any map can be colored with just four colors.

Very hard to prove!

Page 37: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

The Five Color Theorem Any map can be colored

with five colors.

Page 38: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

From maps to graphs

● Do you think we could represent this map as a graph?

Page 39: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

From maps to graphs

● Regions -> points, edges connect adjacent regions

Like this!

Page 40: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

From maps to graphs

If we represent a map as a graph, is it planar?

Page 41: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

From maps to graphs

● If we represent a map as a graph, is it planar?● YES!

Page 42: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

The Five Color Theorem

We can restate the result:

Every planar graph can be colored with five colors so that any two vertices connected by an edge have different colors.

Using graph theory language!

Page 43: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

● What about for planar graphs with at most 5 vertices?

Page 44: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

● What about for planar graphs with at most 5 vertices?● Just make each vertex a different color!

Page 45: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

● Now, let’s consider more general planar graphs.● A fact from math: Every planar graph has a vertex that’s

connected to at most 5 edges.

Page 46: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

● Now, let’s consider more general planar graphs.● A fact from math: Every planar graph has a vertex that’s

connected to at most 5 edges.● What if we’ve colored our graph except for that vertex?

Page 47: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

● In other words, we’ve colored our graph except for one vertex that’s connected to at most 5 edges.

Page 48: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

● We’ve colored our graph except for one vertex that’s connected to at most 5 edges.

○ What if it’s only connected to 4 edges?

Image credit: https://astarmathsandphysics.com/university-maths-notes/topology/2389-the-four-colour-mapping-theorem.html

Page 49: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

● We’ve colored our graph except for one vertex that’s connected to at most 5 edges.

○ What if it’s only connected to exactly 5 edges?

Image credit: http://cgm.cs.mcgill.ca/~athens/cs507/Projects/2003/MatthewWahab/5color.html

Page 50: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

● We’ve colored our graph except for one vertex that’s connected to at most 5 edges.

○ What if it’s only connected to exactly 5 edges?

Image credit: http://cgm.cs.mcgill.ca/~athens/cs507/Projects/2003/MatthewWahab/5color.html

Can we make the red vertex yellow?

Page 51: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

● Let’s say we’ve colored our graph except for one vertex that’s connected to at most 5 edges.

○ What if it’s only connected to exactly 5 edges?

Image credit: http://cgm.cs.mcgill.ca/~athens/cs507/Projects/2003/MatthewWahab/5color.html

What if they’re connected?

Page 52: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

● Let’s say we’ve colored our graph except for one vertex that’s connected to at most 5 edges.

○ What if it’s only connected to exactly 5 edges?

Image credit: http://cgm.cs.mcgill.ca/~athens/cs507/Projects/2003/MatthewWahab/5color.html

Can we make the green vertex yellow?

Page 53: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

● Let’s say we’ve colored our graph except for one vertex that’s connected to at most 5 edges.

○ What if it’s only connected to exactly 5 edges?

Image credit: http://cgm.cs.mcgill.ca/~athens/cs507/Projects/2003/MatthewWahab/5color.html

What if they’re connected?

Page 54: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

● Let’s say we’ve colored our graph except for one vertex that’s connected to at most 5 edges.

○ What if it’s only connected to exactly 5 edges?

Image credit: http://cgm.cs.mcgill.ca/~athens/cs507/Projects/2003/MatthewWahab/5color.html

Can we make the blue vertex red?

Page 55: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

● Let’s say we’ve colored our graph except for one vertex that’s connected to at most 5 edges.

○ What if it’s only connected to exactly 5 edges?

Image credit: http://cgm.cs.mcgill.ca/~athens/cs507/Projects/2003/MatthewWahab/5color.html

What if they’re connected?

Page 56: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

● Let’s say we’ve colored our graph except for one vertex that’s connected to at most 5 edges.

○ What if it’s only connected to exactly 5 edges?

Image credit: http://cgm.cs.mcgill.ca/~athens/cs507/Projects/2003/MatthewWahab/5color.html

What if they’re connected?

THEY CAN’T BE--our graph is planar.

Page 57: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

● Can we always either make the green vertex yellow OR make the red vertex blue?

Image credit: http://cgm.cs.mcgill.ca/~athens/cs507/Projects/2003/MatthewWahab/5color.html

We don’t know what the rest of our graph looks like!

Page 58: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

● The only time we can’t make the green vertex yellow is when something like this happens...

Image credit: http://cgm.cs.mcgill.ca/~athens/cs507/Projects/2003/MatthewWahab/5color.html

Page 59: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

● The only time we can’t make the green vertex yellow is when something like this happens...

● And then, since our graph is planar, we will be able to make the red vertex blue!

Image credit: http://cgm.cs.mcgill.ca/~athens/cs507/Projects/2003/MatthewWahab/5color.html

Page 60: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

Image credit: http://cgm.cs.mcgill.ca/~athens/cs507/Projects/2003/MatthewWahab/5color.html

● We’ve colored our graph except for one vertex that’s connected to exactly 5 edges.

● We can color the neighboring vertices with just 4 colors...

Page 61: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Why is this true?

Image credit: http://cgm.cs.mcgill.ca/~athens/cs507/Projects/2003/MatthewWahab/5color.html

● We’ve colored our graph except for one vertex that’s connected to exactly 5 edges.

● We can color the neighboring vertices with just 4 colors... and the middle vertex with the fifth.

Page 62: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Mathematical induction

● We know that a graph with 1 vertex can be 5-colored ● We know that if we can 5-color a graph with n vertices,

then we can 5-color a graph with n+1 vertices (why?)

Page 63: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Mathematical induction

● We know that a graph with 1 vertex can be 5-colored ● We know that if we can 5-color a graph with n vertices,

then we can 5-color a graph with n+1 vertices (why?)● By induction, this proves the 5-color theorem!

Page 64: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Context and Applications

Page 65: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

You can do lots of other things with graphs...

● We’ve focused on undirected, unweighted graphs● But you could have graphs with directed edges

Image credit: Wikimedia

Page 66: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

You can do lots of other things with graphs...

● We’ve focused on undirected, unweighted graphs● But you could have graphs with weighted edges

Image credit: http://pages.cpsc.ucalgary.ca/~jacobs/Courses/cpsc331/F08/tutorials/tutorial14.html

Page 67: Graph Theory - Carnegie Mellon School of Computer Sciencekcordwel/GraphTheoryandColoring.pdfGraph theory Question: What information determines a graph? Answer: Just the vertices (points)

Graph Theory Uses

● Modeling○ Social networks○ Rumor spreading○ Disease transmission○ Molecules○ Atomic structures

● Advanced math○ Knot theory○ Group theory