Fun and Games with Graphs CS200 - Graphs 1 8 7 7 5 9 S 5 15 - - PowerPoint PPT Presentation

fun and games with graphs
SMART_READER_LITE
LIVE PREVIEW

Fun and Games with Graphs CS200 - Graphs 1 8 7 7 5 9 S 5 15 - - PowerPoint PPT Presentation

Fun and Games with Graphs CS200 - Graphs 1 8 7 7 5 9 S 5 15 6 8 9 11 Do Dijkstras Shortest Paths Algorithm, Source: S CS200 - Class Overview 2 8 7 7 5 9 S 5 15 6 8 9 11 Do Prims Minimum Spanning Tree Algorithm,


slide-1
SLIDE 1

Fun and Games with Graphs

CS200 - Graphs 1

slide-2
SLIDE 2

CS200 - Class Overview 2

Do Dijkstra’s Shortest Paths Algorithm, Source: S

S 7 9 8 5 7 5 15 6 8 9 11

slide-3
SLIDE 3

CS200 - Class Overview 3

S 7 9 8 5 7 5 15 6 8 9 11

Do Prim’s Minimum Spanning Tree Algorithm, Source: S

slide-4
SLIDE 4

Bridges of Konigsberg Problem

http://yeskarthi.wordpress.com/2006/07/31/euler-and-the-bridges-of-konigsberg/

Euler Is it possible to travel across every bridge without crossing any bridge more than once?

CS200 - Graphs 4

slide-5
SLIDE 5

Eulerian paths/circuits

n Eulerian path: a path that visits each edge in

the graph once

n Eulerian circuit: a cycle that visits each edge in

the graph once

n Is there a simple criterion that allows us to

determine whether a graph has an Eulerian circuit or path?

CS200 - Graphs 5

slide-6
SLIDE 6

Example: Does any graph have an Eulerian path?

6

a b c d e a b c d e a b c d e

CS200 - Graphs

G1 G2 G3

slide-7
SLIDE 7

Example: Does any graph have an Eulerian circuit?

7

a b c d e a b c d e a b c d e

CS200 - Graphs

G1 G2 G3

slide-8
SLIDE 8

Example: Does any graph have an Eulerian circuit or path?

8

a b c d a b d e f c g a b c d

CS200 - Graphs

G1 G2 G3

slide-9
SLIDE 9

Theorems about Eulerian Paths & Circuits

n Theorem: A connected multigraph has an

Eulerian path iff it has exactly zero or two vertices of odd degree.

n Theorem: A connected multigraph, with at

least two vertices, has an Eulerian circuit iff each vertex has an even degree.

q Demo:

http://www.mathcove.net/petersen/lessons/get- lesson?les=23

CS200 - Graphs 9

slide-10
SLIDE 10

Hamiltonian Paths/Circuits

n A Hamiltonian path/circuit:

path/circuit that visits every vertex exactly once.

n Defined for directed and

undirected graphs

CS200 - Graphs 10

slide-11
SLIDE 11

Circuits (cont.)

n Hamiltonian Circuit: path that begins at vertex

v, passes through every vertex in the graph exactly once, and ends at v.

q http://www.mathcove.net/petersen/lessons/get-

lesson?les=24

CS200 - Graphs 11

slide-12
SLIDE 12

Does any graph have a Hamiltonian circuit or a Hamiltonian path?

12

a b c d e a b c d a b c d e

CS200 - Graphs

slide-13
SLIDE 13

Hamiltonian Paths/Circuits

n Is there an efficient way to determine whether

a graph has a Hamiltonian circuit?

q NO! q This problem belongs to a class of problems for

which it is believed there is no efficient (polynomial running time) algorithm.

CS200 - Graphs 13

slide-14
SLIDE 14

The Traveling Salesman Problem

13,509 cities and towns in the US that have more than 500 residents

http://www.tsp.gatech.edu/ TSP: Given a list of cities and their pairwise distances, find a shortest possible tour that visits each city exactly once.

CS200 - Graphs 14

slide-15
SLIDE 15

Using Hamiltonian Circuits

n Examine all possible Hamiltonian circuits and

select one of minimum total length

n With n cities..

q (n-1)! Different Hamiltonian circuits q Ignore the reverse ordered circuits q (n-1)!/2

n With 50 cities n 12,413,915,592,536,072,670,862,289,047,373,3

75,038,521,486,354,677,760,000,000,000 routes

15 CS200 - Graphs

slide-16
SLIDE 16

TSP

n How would a approximating algorithm for TSP

work?

71,009 Cities in China Local search: construct a solution and then modify it to improve it

CS200 - Graphs 16

slide-17
SLIDE 17

Planar Graphs

n You are designing a

microchip – connections between any two units cannot cross

http://www.dmoma.org/

CS200 - Graphs 17

slide-18
SLIDE 18

Planar Graphs

n You are designing a

microchip – connections between any two units cannot cross

n The graph describing the

chip must be planar

planar non-planar

http://en.wikipedia.org/wiki/Planar_graph

CS200 - Graphs 18

slide-19
SLIDE 19

Are these graphs planar?

19 CS200 - Graphs

slide-20
SLIDE 20

Chip Design

n You want more than

planarity: the lengths of the connections need to be as short as possible (faster, and less heat is generated)

n We are now designing 3D

chips, less constraint w.r.t. planarity, and shorter distances, but harder to build.

http://www.dmoma.org/

CS200 - Graphs 20

slide-21
SLIDE 21

Graph Coloring

n A coloring of a simple graph is the

assignment of a color to each vertex of the graph so that no two adjacent vertices are assigned the same color

21 CS200 - Graphs

slide-22
SLIDE 22

Map and graph

22

B A C D E F G A B C D G E F

CS200 - Graphs

slide-23
SLIDE 23

Chromatic number

n The least number of colors needed for a

coloring of this graph.

n The chromatic number of a graph G is

denoted by χ(G)

23 CS200 - Graphs

slide-24
SLIDE 24

The four color theorem

n The chromatic number of a planar graph is no

greater than four

n This theorem was proved by a (theorem

prover) program!

24 CS200 - Graphs

slide-25
SLIDE 25

Example

25 CS200 - Graphs

slide-26
SLIDE 26

Example

26 CS200 - Graphs