152
Graph Theory Part One

Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Graph TheoryPart One

Page 2: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Outline for Today

● A Pointer to Cantor's Theorem● Where to go for fun with diagonalization!

● Graphs● A ubiquitous structure in computer science.

● Paths and Cycles● How do you get from here to there?

● Connected Components● How do we talk about “pieces” of graphs?

● Planar Graphs● Definitions straight from visuals.

● Graph Coloring● Applications to cartography and cell phone towers... plus a nifty

history lesson!

Page 3: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Cantor's Theorem

Page 4: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Cantor's Theorem

● Last time, we explored equal and unequal set cardinalities. We proved that |ℕ| ≠ |ℝ|.

● Cantor's theorem from our first lecture uses a similar proof technique.

● In the interest of time, I've moved the proof to a “Guide to Cantor's Theorem” up on the course website.

● Read over this sometime between now and Friday – it'll come up on PS4.

Page 5: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Graphs!

Page 6: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

http://strangemaps.files.wordpress.com/2007/02/fullinterstatemap-web.jpg

Page 7: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Chemical Bonds

http://4.bp.blogspot.com/-xCtBJ8lKHqA/Tjm0BONWBRI/AAAAAAAAAK4/-mHrbAUOHHg/s1600/Ethanol2.gif

Page 8: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

http://www.toothpastefordinner.com/

Page 9: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

http://www.prospectmagazine.co.uk/wp-content/uploads/2009/09/163_taylor2.jpg

Page 10: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 11: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Me too!

Page 12: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

http://www.thedigitalbridges.com/wp-content/uploads/2015/11/internet-small-world.jpg

Page 13: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

What's in Common

● Each of these structures consists of● a collection of objects and● links between those objects.

● Goal: find a general framework for describing these objects and their properties.

Page 14: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A graph is a mathematical structurefor representing relationships.

A graph consists of a set of nodes connected by edges.

Page 15: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A graph is a mathematical structurefor representing relationships.

A graph consists of a set of nodes (or vertices) connected by edges (or arcs)

Page 16: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A graph is a mathematical structurefor representing relationships.

A graph consists of a set of nodes (or vertices) connected by edges (or arcs)

Nodes

Page 17: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A graph is a mathematical structurefor representing relationships.

A graph consists of a set of nodes (or vertices) connected by edges (or arcs)

Edges

Page 18: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Some graphs are directed.

Page 19: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

CAT SAT RAT

RANMAN

MAT

CAN

Some graphs are undirected.

Page 20: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Going forward, we're primarily going to focus on undirected graphs.

The term “graph” generally refers to undirected graphs unless specified

otherwise.

Page 21: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Formalizing Graphs

● How might we define a graph mathematically?

● We need to specify● what the nodes in the graph are, and● which edges are in the graph.

● The nodes can be pretty much anything.● What about the edges?

Page 22: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Formalizing Graphs

● An unordered pair is a set {a, b} of two elements (remember that sets are unordered).● {0, 1} = {1, 0}

● An undirected graph is an ordered pair G = (V, E), where● V is a set of nodes, which can be anything, and● E is a set of edges, which are unordered pairs of nodes

drawn from V.

● A directed graph is an ordered pair G = (V, E), where● V is a set of nodes, which can be anything, and● E is a set of edges, which are ordered pairs of nodes

drawn from V.

Page 23: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Self-Loops

● An edge from a node to itself is called a self-loop.● In undirected graphs, self-loops are generally not

allowed unless specified otherwise.● This is mostly to keep the math easier. If you allow self-

loops, a lot of results get messier and harder to state.

● In directed graphs, self-loops are generally allowed unless specified otherwise.

✓×

Page 24: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Standard Graph Terminology

Page 25: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

CAT SAT RAT

RANMAN

MAT

CAN

Two nodes are called adjacent if there is an edge between them.

Page 26: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

CAT SAT RAT

RANMAN

MAT

CAN

Two nodes are called adjacent if there is an edge between them.

Page 27: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

CAT SAT RAT

RANMAN

MAT

CAN

Two nodes are called adjacent if there is an edge between them.

Page 28: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

CAT SAT RAT

RANMAN

MAT

CAN

Two nodes are called adjacent if there is an edge between them.

Page 29: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Using our Formalisms

● Let G = (V, E) be a graph.● Intuitively, two nodes are adjacent if

they're linked by an edge.● Formally speaking, we say that two

nodes u, v ∈ V are adjacent if {u, v} ∈ E.

Page 30: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

http://strangemaps.files.wordpress.com/2007/02/fullinterstatemap-web.jpg

Page 31: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

http://strangemaps.files.wordpress.com/2007/02/fullinterstatemap-web.jpg

Page 32: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

SF Sac

Port

Sea But

SLC

Mon

LV

Bar Flag

LA

SD Nog

Phoe

Page 33: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

SF Sac

Port

Sea But

SLC

Mon

LV

Bar Flag

LA

SD Nog

Phoe

From

To

Page 34: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

SLC

LA

SD

But

Mon

LV

Bar Flag

Nog

Phoe

SF Sac

Port

Sea

From

To

Page 35: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

LA

SD

But

Mon

LV

Bar Flag

Nog

Phoe

SLCSF Sac

Port

Sea

From

To

Page 36: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

SD Nog

Port

SLC

LA

But

Mon

LV

Bar Flag

Phoe

SF Sac

Sea

From

To

Page 37: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

SD Nog

Port

SLC

LA

But

Mon

LV

Bar Flag

Phoe

SF Sac

Sea

From

To A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

Page 38: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

SD Nog

Port

SLC

LA

But

Mon

LV

Bar Flag

Phoe

SF Sac

Sea

From

To A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

Page 39: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

SF Sac

Port

Sea But

SLC

Mon

LV

Bar Flag

LA

SD Nog

Phoe

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

Page 40: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

SF Sac

Mon

LV

Bar Flag

LA

SD Nog

Phoe

Port

Sea But A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

SLC

Page 41: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Flag

SF

SD Nog

Phoe

Sac

Mon

LV

Bar

LA

Port

Sea But A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

SLC

Page 42: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Flag

SF

SD Nog

Phoe

Sac

Mon

LV

Bar

LA

Port

Sea But A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

SLC

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

Page 43: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

SF Sac

Port

Sea But

SLC

Mon

LV

Bar Flag

LA

SD Nog

Phoe

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

Page 44: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

SF Sac

Port

Sea But

SLC

Mon

LV

Bar Flag

LA

SD Nog

Phoe

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

Page 45: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Sac

Port

Sea But

SLC

Mon

LV

Bar Flag

LA

SD Nog

Phoe

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

SF

Page 46: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Port

Sea But

SLC

Mon

LV

Bar Flag

LA

SD Nog

Phoe

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

SacSF

Page 47: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Port

Sea But

SLC

Mon

LV

Bar Flag

SD Nog

Phoe

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

SacSF

LA

Page 48: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Port

Sea But

SLC

Mon

LV

Bar Flag

SD Nog

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

SacSF

PhoeLA

Page 49: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Port

Sea But

SLC

Mon

LV

Bar

SD Nog

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

SacSF

PhoeLA

Flag

Page 50: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Port

Sea But

SLC

Mon

LV

SD Nog

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

SacSF

PhoeLA

FlagBar

Page 51: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Port

Sea But

SLC

Mon

LV

SD Nog

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

SacSF

PhoeLA

FlagBar

Page 52: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Port

Sea But

SLC

Mon

LV

SD Nog

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

SacSF

PhoeLA

FlagBar

Page 53: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A simple path in a graph is path that does not repeat any nodes or edges.

A simple path in a graph is path that does not repeat any nodes or edges.

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

Port

Sea But

SLC

Mon

LV

SD Nog

SacSF

PhoeLA

FlagBar

Page 54: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A simple path in a graph is path that does not repeat any nodes or edges.

A simple path in a graph is path that does not repeat any nodes or edges.

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

Port

Sea But

SLC

Mon

LV

SD Nog

SacSF

PhoeLA

FlagBar

Page 55: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A simple path in a graph is path that does not repeat any nodes or edges.

A simple path in a graph is path that does not repeat any nodes or edges.

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

Port

Sea But

SLC

Mon

LV

SD Nog

SF

PhoeLA

FlagBar

Sac

Page 56: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A simple path in a graph is path that does not repeat any nodes or edges.

A simple path in a graph is path that does not repeat any nodes or edges.

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

Port

Sea But

Mon

LV

SD Nog

SF

PhoeLA

FlagBar

Sac SLC

Page 57: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A simple path in a graph is path that does not repeat any nodes or edges.

A simple path in a graph is path that does not repeat any nodes or edges.

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

Sea But

Mon

LV

SD Nog

SF

PhoeLA

FlagBar

Sac SLC

Port

Page 58: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A simple path in a graph is path that does not repeat any nodes or edges.

A simple path in a graph is path that does not repeat any nodes or edges.

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

Sea But

Mon

LV

SD Nog

SF

PhoeLA

FlagBar

Sac SLC

Port

Page 59: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A simple path in a graph is path that does not repeat any nodes or edges.

A simple path in a graph is path that does not repeat any nodes or edges.

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

Sea But

Mon

LV

SD Nog

SF

PhoeLA

FlagBar

Sac SLC

Port

Page 60: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A simple path in a graph is path that does not repeat any nodes or edges.

A simple path in a graph is path that does not repeat any nodes or edges.

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

Sea But

Mon

LV

SD Nog

SF

PhoeLA

FlagBar

Sac SLC

Port

Page 61: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A simple path in a graph is path that does not repeat any nodes or edges.

A simple path in a graph is path that does not repeat any nodes or edges.

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

Sea But

Mon

LV

SD Nog

SF

PhoeLA

FlagBar

Sac SLC

Port

Page 62: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A cycle in a graph is a path from a node back to itself. (By convention, a cycle cannot consist of a single node.)

A simple path in a graph is path that does not repeat any nodes or edges.

A simple path in a graph is path that does not repeat any nodes or edges.

The length of a path is the number of edges in it.

The length of a path is the number of edges in it.

Sea But

Mon

LV

SD Nog

SF

PhoeLA

FlagBar

Sac SLC

Port

A simple cycle in a graph is cycle that does not repeat any nodes or edges except the first/last node.

A simple cycle in a graph is cycle that does not repeat any nodes or edges except the first/last node.

Page 63: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

Sea But

Mon

LV

SD Nog

SF

PhoeLA

FlagBar

Sac SLC

Port

Page 64: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

Sea But

Mon

LV

SD Nog

SF

PhoeLA

FlagBar

Sac SLC

Port

Page 65: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

Sea But

Mon

LV

SD Nog

SF

PhoeLA

FlagBar

Sac SLC

Port

Page 66: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

Sea But

Mon

LV

SD Nog

SF

PhoeLA

FlagBar

Sac SLC

PortFrom

To

Page 67: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

Sea But

Mon

LV

SD Nog

SF

PhoeLA

FlagBar

Sac SLC

PortFrom

To

Page 68: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

Sea But

Mon

LV

SD Nog

SF

PhoeLA

FlagBar

Sac SLC

PortFrom

To

Two nodes in a graph are called connected if there is a path between them.

Two nodes in a graph are called connected if there is a path between them.

Page 69: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

A path in a graph G = (V, E) is a sequence of one or more nodes v₁, v₂, v₃, …, vₙ such that any two consecutive nodes in the sequence are adjacent.

Sea But

Mon

LV

SD Nog

SF

PhoeLA

FlagBar

Sac SLC

PortFrom

To

Two nodes in a graph are called connected if there is a path between them.

Two nodes in a graph are called connected if there is a path between them.

A graph G as a whole is called connected if all pairs of nodes in G are connected.

A graph G as a whole is called connected if all pairs of nodes in G are connected.

Page 70: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Time-Out for Announcements!

Page 71: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Midterm Exam

● The first midterm exam is next Monday, October 24 from 3:00PM – 4:20PM. Locations are divvied up by last (family) name:● Abd – Pan: Go to Hewlett 200.● Pap – Zub: Go to Nvidia Auditorium.

● Covers material from PS1 – PS2. Later concepts will not be tested (yet).

● You're responsible for Lectures 00 – 05 and for topics covered on PS1 – PS2.

● Exam is closed-book, closed-computer, and limited-note. You can bring an 8.5” × 11” sheet of notes with you when you take the exam.

● EPP1 solutions are now available online; EPP2 has just been released. The practice midterm and solutions are available online as well.

Page 72: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 73: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

PS2: Common Mistakes

Page 74: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

What is the negation of the statementP(x) → Q(x)?

Answer: P(x) ∧ ¬Q(x).

Incorrect Answer: P(x) → ¬Q(x).

Page 75: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Suppose you want to prove the statement “if P(x) is true, then Q(x) is true” by contradiction. What should you

assume?

Answer: P(x) is true and Q(x) is false.

Incorrect Answer: If P(x) is true, then Q(x) is false.

Page 76: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A function that takes in real numbers and produces real numbers is called an exponential function if the following statement is true:

∀a ∈ . ∀ℝ b ∈ . ℝ f(a + b) = f(a) · f(b).

Prove that if f is an exponential function and f is zero anywhere, then it's zero everywhere.

Page 77: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Key Skill: Know how to set up proofs!

Page 78: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

What I'm Assuming What I Need to Show

“If f is an exponential function and f is zero anywhere, then f is zero everywhere.”

f is an exponential function

f is zero somewhere

f is zero everywhere∀a ∈ ℝ. ∀b ∈ ℝ. f(a + b) = f(a) · f(b)

There's an x ∈ ℝ where f(x) = 0.

For any y ∈ ℝ, f(y) = 0.

f(a + b) = f(a) · f(b)

y x

Show f(y) = 0

Proof: Let f be an exponential function and assume that f(x) = 0. We will provethat f is zero everywhere. To do so, choose an arbitrary y ∈ ℝ. We will showthat f(y) = 0. Since f is an exponential function, we know that

f(y) = f((y – x) + x) = f(y – x) · f(x) = f(y – x) · 0 = 0.

This means that f(y) = 0, as required. ■

Proof: Let f be an exponential function and assume that f(x) = 0. We will provethat f is zero everywhere. To do so, choose an arbitrary y ∈ ℝ. We will showthat f(y) = 0. Since f is an exponential function, we know that

f(y) = f((y – x) + x) = f(y – x) · f(x) = f(y – x) · 0 = 0.

This means that f(y) = 0, as required. ■

Page 79: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

What I'm Assuming What I Need to Show

“If f is an exponential function and f is zero anywhere, then f is zero everywhere.”

f is an exponential function

f is zero somewhere

f is zero everywhere∀a ∈ ℝ. ∀b ∈ ℝ. f(a + b) = f(a) · f(b)

There's an x ∈ ℝ where f(x) = 0.

For any y ∈ ℝ, f(y) = 0.

f(a + x) = f(a) · f(x)

y x

Proof: Let f be an exponential function and assume that f(x) = 0. We will provethat f is zero everywhere. To do so, choose an arbitrary y ∈ ℝ. We will showthat f(y) = 0. Since f is an exponential function, we know that

f(y) = f((y – x) + x) = f(y – x) · f(x) = f(y – x) · 0 = 0.

This means that f(y) = 0, as required. ■

Proof: Let f be an exponential function and assume that f(x) = 0. We will provethat f is zero everywhere. To do so, choose an arbitrary y ∈ ℝ. We will showthat f(y) = 0. Since f is an exponential function, we know that

f(y) = f((y – x) + x) = f(y – x) · f(x) = f(y – x) · 0 = 0.

This means that f(y) = 0, as required. ■

Show f(y) = 0

Page 80: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

What I'm Assuming What I Need to Show

“If f is an exponential function and f is zero anywhere, then f is zero everywhere.”

f is an exponential function

f is zero somewhere

f is zero everywhere∀a ∈ ℝ. ∀b ∈ ℝ. f(a + b) = f(a) · f(b)

There's an x ∈ ℝ where f(x) = 0.

For any y ∈ ℝ, f(y) = 0.

f((y – x) + x) = f(y – x) · f(x)

y x

Proof: Let f be an exponential function and assume that f(x) = 0. We will provethat f is zero everywhere. To do so, choose an arbitrary y ∈ ℝ. We will showthat f(y) = 0. Since f is an exponential function, we know that

f(y) = f((y – x) + x) = f(y – x) · f(x) = f(y – x) · 0 = 0.

This means that f(y) = 0, as required. ■

Proof: Let f be an exponential function and assume that f(x) = 0. We will provethat f is zero everywhere. To do so, choose an arbitrary y ∈ ℝ. We will showthat f(y) = 0. Since f is an exponential function, we know that

f(y) = f((y – x) + x) = f(y – x) · f(x) = f(y – x) · 0 = 0.

This means that f(y) = 0, as required. ■

Show f(y) = 0

Page 81: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

What I'm Assuming What I Need to Show

“If f is an exponential function and f is zero anywhere, then f is zero everywhere.”

f is an exponential function

f is zero somewhere

f is zero everywhere∀a ∈ ℝ. ∀b ∈ ℝ. f(a + b) = f(a) · f(b)

There's an x ∈ ℝ where f(x) = 0.

For any y ∈ ℝ, f(y) = 0.

f((y – x) + x) = f(y – x) · f(x)

y x

Proof: Let f be an exponential function and assume that f(x) = 0. We will provethat f is zero everywhere. To do so, choose an arbitrary y ∈ ℝ. We will showthat f(y) = 0. Since f is an exponential function, we know that

f(y) = f((y – x) + x) = f(y – x) · f(x) = f(y – x) · 0 = 0.

This means that f(y) = 0, as required. ■

Proof: Let f be an exponential function and assume that f(x) = 0. We will provethat f is zero everywhere. To do so, choose an arbitrary y ∈ ℝ. We will showthat f(y) = 0. Since f is an exponential function, we know that

f(y) = f((y – x) + x) = f(y – x) · f(x) = f(y – x) · 0 = 0.

This means that f(y) = 0, as required. ■

Show f(y) = 0

Page 82: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

To Recap

● Write out what you're assuming.● Write out what you need to prove.● Write out the beginning of the proof, clearly articulating

what you need to prove, even if you're not sure what the rest of the proof will look like.

● Then, spend your creative energies trying to bridge the assumptions and the goal.

● Students who are comfortable setting up proofs this way do dramatically better than average on the midterms. Students who haven't mastered this skill do dramatically worse than average on the midterms.

● I'd go as far as saying that this is the single best predictor of how someone will do on the exam.

Page 83: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Your Questions

Page 84: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

“What kind of trouble/mischief did you get into while you were a Stanford student?”

(Answered in class).(Answered in class).

Page 85: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Back to CS103!

Page 86: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Connected Components

Page 87: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 88: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 89: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 90: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

An Initial Definition

● Attempted Definition #1: A piece of an undirected graph G = (V, E) is a setC ⊆ V where

∀u ∈ C. ∀v ∈ C. Connected(u, v)● Intuition: a piece of a graph is a set of

nodes that are all connected to one another.

⚠ This definition has problems; ⚠ please don't use it as a reference.

Page 91: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 92: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 93: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 94: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 95: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 96: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 97: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

An Updated Definition

● Attempted Definition #2: A piece of an undirected graph G = (V, E) is a set C ⊆ V where● ∀u ∈ C. ∀v ∈ C. Connected(u, v)● ∀u ∈ C. ∀v ∈ V – C. ¬Connected(u, v)

● Intuition: a piece of a graph is a set of nodes that are all connected to one another that doesn't “miss” any nodes.

⚠ This definition has problems; ⚠ please don't use it as a reference.

Page 98: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 99: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 100: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 101: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 102: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 103: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 104: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A Final Definition

● Definition: A connected component of an undirected graph G = (V, E) is a nonempty set C ⊆ V where● ∀u ∈ C. ∀v ∈ C. Connected(u, v)● ∀u ∈ C. ∀v ∈ V – C. ¬Connected(u, v)

Page 105: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A Concern

● We've just come up with a definition of what a connected component is, but we haven't actually shown that they necessarily exist!

● Ideally, we'd like to be able to prove the following properties:● For any graph G = (V, E), every v ∈ V belongs to

at least one connected component of G.● For any graph G = (V, E), every v ∈ V belongs to

at most one connected component of G.

● Do those properties look familiar?

Page 106: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Return of the Equivalence Classes

● Earlier, when talking about binary relations, we proved that if R is an equivalence relation over a set A, then every a ∈ A belongs to exactly one equivalence class of R.

● Claim 1: For any graph G, the “is connected to” relation is an equivalence relation.● Is it reflexive?● Is it symmetric?● Is it transitive?

Page 107: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Return of the Equivalence Classes

● Earlier, when talking about binary relations, we proved that if R is an equivalence relation over a set A, then every a ∈ A belongs to exactly one equivalence class of R.

● Claim 2: The connected components of a graph G are the equivalence classes of its connectivity relation!

Page 108: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Theorem: Let G = (V, E) be an arbitrary graph and let C be the binaryrelation over V where xCy if nodes x and y are connected in G. Then forany v ∈ V, the equivalence class [v]C is the connected component of Gcontaining v.

Proof: We already know that v ∈ [v]C, so all we need to do is prove that [v]C

is a connected component of G.

First, we'll prove that [v]C is nonempty. This follows from the fact that v ∈ [v]C.

Second, we'll prove that any two nodes x, y ∈ [v]C that x and y are connected in G. Since x, y ∈ [v]C, we know that v and x are connected and that v and y are connected. Therefore, we see that x and y are connected, as required.

Finally, we'll prove that if we pick a node x ∈ [v]C and a node y ∉ [v]C, then x and y are not connected in G. Since x ∈ [v]C, we know that x and v are connected, and since y ∉ [v]C, we know that y and v are not connected. So assume for the sake of contradiction that x and y are connected. Then, since v and x are connected and x and y are connected, we learn that v and y are connected, contradicting our earlier assumption. We have reached a contradiction, so our assumption was wrong. Therefore, x and y are not connected, as required. ■

Page 109: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Why This Matters

● The fact that connected components are equivalence classes gives us a bunch of theorems for free:● Every node in any graph belongs to exactly one connected

component in the graph.● Any two connected components in a graph are either exactly the

same or have no nodes in common.

● Philosophically, we've also seen some key ideas from mathematics:● When we first defined connected components, we just had a gut

feeling about what they were supposed to be. We iteratively refined the definition until we found one we liked.

● We then had to show that the definition actually applied to something by finding a mathematical object meeting the requisite criteria.

● This idea – specifying an object, then going and finding it – is common throughout mathematics.

Page 110: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Planar Graphs

Page 111: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 112: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 113: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 114: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

21

4 3

Page 115: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

2

1

4 3

Page 116: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 117: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 118: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 119: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 120: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 121: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 122: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 123: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 124: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 125: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

This graph is called the utility graph. There is no way to draw it in the plane

without edges crossing.

This graph is called the utility graph. There is no way to draw it in the plane

without edges crossing.

Page 126: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A graph is called a planar graph if there is some way to draw it in a 2D plane without

any of the edges crossing.

Page 127: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 128: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 129: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 130: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 131: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 132: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 133: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 134: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A Fun (And Strangely Addicting) Game:http://planarity.net/

Page 135: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

A Fantastic Video on a Cool Theorem:https://www.youtube.com/watch?v=-9OUyo8NFZg

Page 136: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Graph Coloring

Page 137: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Graph Coloring

Page 138: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 139: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in
Page 140: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

● Intuitively, a k-coloring of a graph G = (V, E) is a way to color each node in V one of k different colors such that no two adjacent nodes in V are the same color.

Formally, a k-coloring of a graph G = (V, E) is a function

f : V → {1, 2, …, k}

such that

∀u ∈ V. ∀v ∈ V. ({u, v} ∈ E → f(u) ≠ f(v))

A graph G is called k-colorable if a k-coloring exists of G.

The smallest k for which G is k-colorable is its chromatic number.

The chromatic number of a graph G is denoted χ(G), from the Greek χρώμα, meaning “color.”

Graph Coloring

Page 141: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

● Intuitively, a k-coloring of a graph G = (V, E) is a way to color each node in V one of k different colors such that no two adjacent nodes in V are the same color.

● Formally, a k-coloring of a graph G = (V, E) is a function

f : V → {1, 2, …, k}

such that

∀u ∈ V. ∀v ∈ V. ({u, v} ∈ E → f(u) ≠ f(v))

A graph G is called k-colorable if a k-coloring exists of G.

The smallest k for which G is k-colorable is its chromatic number.

The chromatic number of a graph G is denoted χ(G), from the Greek χρώμα, meaning “color.”

Graph Coloring

Page 142: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

● Intuitively, a k-coloring of a graph G = (V, E) is a way to color each node in V one of k different colors such that no two adjacent nodes in V are the same color.

● Formally, a k-coloring of a graph G = (V, E) is a function

f : V → {1, 2, …, k}

such that

∀u ∈ V. ∀v ∈ V. ({u, v} ∈ E → f(u) ≠ f(v))

A graph G is called k-colorable if a k-coloring exists of G.

The smallest k for which G is k-colorable is its chromatic number.

The chromatic number of a graph G is denoted χ(G), from the Greek χρώμα, meaning “color.”

Graph Coloring

Page 143: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

● Intuitively, a k-coloring of a graph G = (V, E) is a way to color each node in V one of k different colors such that no two adjacent nodes in V are the same color.

● Formally, a k-coloring of a graph G = (V, E) is a function

f : V → {1, 2, …, k}

such that

∀u ∈ V. ∀v ∈ V. ({u, v} ∈ E → f(u) ≠ f(v))

A graph G is called k-colorable if a k-coloring exists of G.

The smallest k for which G is k-colorable is its chromatic number.

The chromatic number of a graph G is denoted χ(G), from the Greek χρώμα, meaning “color.”

Graph Coloring

Page 144: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

● Intuitively, a k-coloring of a graph G = (V, E) is a way to color each node in V one of k different colors such that no two adjacent nodes in V are the same color.

● Formally, a k-coloring of a graph G = (V, E) is a function

f : V → {1, 2, …, k}

such that

∀u ∈ V. ∀v ∈ V. ({u, v} ∈ E → f(u) ≠ f(v))

A graph G is called k-colorable if a k-coloring exists of G.

The smallest k for which G is k-colorable is its chromatic number.

The chromatic number of a graph G is denoted χ(G), from the Greek χρώμα, meaning “color.”

Graph Coloring

1

3

2

4 3

1

Page 145: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

● Intuitively, a k-coloring of a graph G = (V, E) is a way to color each node in V one of k different colors such that no two adjacent nodes in V are the same color.

● Formally, a k-coloring of a graph G = (V, E) is a function

f : V → {1, 2, …, k}

such that

∀u ∈ V. ∀v ∈ V. ({u, v} ∈ E → f(u) ≠ f(v))

A graph G is called k-colorable if a k-coloring exists of G.

The smallest k for which G is k-colorable is its chromatic number.

The chromatic number of a graph G is denoted χ(G), from the Greek χρώμα, meaning “color.”

Graph Coloring

Although this is the formal definition of ak-coloring, you rarely see it used in proofs. It's more common to just talk about assigning colors to nodes. However, this definition is super useful if you want to write programs to reason about graph colorings!

Although this is the formal definition of ak-coloring, you rarely see it used in proofs. It's more common to just talk about assigning colors to nodes. However, this definition is super useful if you want to write programs to reason about graph colorings!

Page 146: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

● Intuitively, a k-coloring of a graph G = (V, E) is a way to color each node in V one of k different colors such that no two adjacent nodes in V are the same color.

● Formally, a k-coloring of a graph G = (V, E) is a function

f : V → {1, 2, …, k}

such that

∀u ∈ V. ∀v ∈ V. ({u, v} ∈ E → f(u) ≠ f(v))● A graph G is called k-colorable if a k-coloring of G exists.● The smallest k for which G is k-colorable is its chromatic

number.● The chromatic number of a graph G is denoted χ(G), from the

Greek χρώμα, meaning “color.”

Graph Coloring

Page 147: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Graph Coloring

Page 148: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Graph Coloring

Page 149: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Theorem (Four-Color Theorem): Every planar graph is 4-colorable.

Page 150: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

● 1850s: Four-Color Conjecture posed.

● 1879: Kempe proves the Four-Color Theorem.

● 1890: Heawood finds a flaw in Kempe's proof.

● 1976: Appel and Haken design a computer program that proves the Four-Color Theorem. The program checked 1,936 specific cases that are “minimal counterexamples;” any counterexample to the theorem must contain one of the 1,936 specific cases.

● 1980s: Doubts rise about the validity of the proof due to errors in the software.

● 1989: Appel and Haken revise their proof and show it is indeed correct. They publish a book including a 400-page appendix of all the cases to check.

● 1996: Roberts, Sanders, Seymour, and Thomas reduce the number of cases to check down to 633.

● 2005: Werner and Gonthier repeat the proof using an established automatic theorem prover (Coq), improving confidence in the truth of the theorem.

Page 151: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Philosophical Question: Is a theorem true if no human has ever read the proof?

Page 152: Graph Theory - Stanford University...Graph Theory Part One Outline for Today A Pointer to Cantor's Theorem Where to go for fun with diagonalization! Graphs A ubiquitous structure in

Next Time

● The Pigeonhole Principle● Results that are “too big to fail.”

● Party Tricks● Graph theory in a social setting.

● A Glimpse of Graph Theory● What we know – and don't – about graphs.