1 topics paths and circuits (11.2) a b c d e f g

17
1 Topics Paths and Circuits (11.2) A B C D E F G

Upload: tabitha-armstrong

Post on 17-Jan-2016

220 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: 1 Topics Paths and Circuits (11.2) A B C D E F G

1

Topics

• Paths and Circuits (11.2)

A

B

C

D

E

F

G

Page 2: 1 Topics Paths and Circuits (11.2) A B C D E F G

2

Definitions (p.667)

• Let G be a graph, and v and w be vertices of G.– A walk from v to w has the form ve1v1e2v2...en-1vn-1enw

where v0 (the starting point) is v and vn (the destination) is w.

Note: Each vi and ei may be repeated.

ene2e1v v1

… w

Exercise: Find example walks from A to G in the graph.

Q: Is there a best walk? Shortest walk?

A

B

C

D

E

F

G

Page 3: 1 Topics Paths and Circuits (11.2) A B C D E F G

3

Why are we concerned with walks in a graph?

– Problem solving, games, gambling, …

– Searching (e.g., searching the Internet)

– Communication– Management– …

• Many real-world applications …– Navigation– Transportation– Computer networks

Network topologyRouting of data packetsWireless network (node movement)…

Page 4: 1 Topics Paths and Circuits (11.2) A B C D E F G

4

Why are we concerned with walks in a graph?

See http://en.wikipedia.org/wiki/Graph_theory#Applications

• “Applications of graph theory are primarily, but not exclusively, concerned with labeled graphs and various specializations of these.

• Structures that can be represented as graphs are ubiquitous, and many problems of practical interest can be represented by graphs.

• The link structure of a website could be represented by a directed graph: the vertices are the web pages available at the website and a directed edge from page A to page B exists if and only if A contains a link to B.

• A similar approach can be taken to problems in travel, biology, computer chip design, and many other fields.

• The development of algorithms to handle graphs is therefore of major interest in computer science.”

Page 5: 1 Topics Paths and Circuits (11.2) A B C D E F G

5

Why are we concerned with

walks in a graph?

• A walk may represent a solution in the problem domain.

• Example: In a sociogram, a walk represents one of the communication paths between two persons in an organization or community.

• With some specialization, concepts such as ‘channels of influence’, ‘most effective communication path’, ‘cliques’, etc. start to make sense.

A

B

C

D

E

F

G

Page 6: 1 Topics Paths and Circuits (11.2) A B C D E F G

6

Connectednessp.669: Let G be a graph.

– Two vertices v and w of G are connected iff there exist a walk from v to w.

– The graph G is connected iff given any two vertices v and w in G, there exist a walk from v to w.

p.670:

A graph H is a connected component of a graph G iff1. H is a subgraph of G,2. H is connected, and3. No connected subgraph of G has H as a subgraph and contains

vertices or edges that are not in H.

A

B

C

D

E

F

G

Example 11.2.4

Exercise: Find all the connected components in the example graph.

Page 7: 1 Topics Paths and Circuits (11.2) A B C D E F G

7

Paths• Let G be a graph, and v and w be

vertices of G.– A path from v to w is a walk

from v to w with no repeated edges.

Note: Repeated vertices are allowed.

Exercise: Find example paths from A to E in the graph.

Q1: How many paths are there?

Q2: What is the shortest path?

A

C

B

D

E

Page 8: 1 Topics Paths and Circuits (11.2) A B C D E F G

8

Simple Paths• Let G be a graph, and v and w be

vertices of G.– A simple path from v to w is a

path from v to w with no repeated vertices.

Note: Neither repeated edges nor repeated vertices are allowed.

Exercise: Find example simple paths from A to E in the graph.

Q1: How many simple paths are there?

Q2: What is the shortest simple path?

A

C

B

D

E

Page 9: 1 Topics Paths and Circuits (11.2) A B C D E F G

9

Closed Walks• Let G be a graph, and v and w be

vertices of G.– A closed walk is a walk that starts

and ends at the same vertex.

Note: Repeated edges and vertices are allowed.

Exercise: Find example closed walks in the graph.

Q1: How many closed walks are there? Does this question make sense at all?

Q2: Starting with node A, how many closed walks are there?

A

C

B

D

E

Page 10: 1 Topics Paths and Circuits (11.2) A B C D E F G

10

Circuits• Let G be a graph, and v and w

be vertices of G.– A circuit is a closed walk

with no repeated edges.

Note: Repeated vertices are allowed.

Exercise: Find example circuits in the graph.

Q1: Starting with node A, how many circuits are there?

A

C

B

D

E

Page 11: 1 Topics Paths and Circuits (11.2) A B C D E F G

11

Simple Circuits• Let G be a graph, and v and w be

vertices of G.– A simple circuit is a circuit with

no repeated vertices.

Note: Neither repeated edges nor repeated vertices are allowed.

Exercise: Find example simple circuits in the graph.

Q1: Starting with node A, how many simple circuits are there?

A

C

B

D

E

A

B

C

D

E

F

Page 12: 1 Topics Paths and Circuits (11.2) A B C D E F G

12

Comparisons• p.667: Table of comparisons• Q: What’s the difference between a walk and a path?• How about a walk and a closed walk?• How about a path and a circuit?• How about a path and a simple path?

• How about a circuit and a simple circuit?

• How about a simple path and a simple circuit?

A

B

C

D

E

F

Page 13: 1 Topics Paths and Circuits (11.2) A B C D E F G

13

Questions?

Page 14: 1 Topics Paths and Circuits (11.2) A B C D E F G

14

Euler Paths• p.675: Let G be a graph. An Euler

path for G is a path that visits each edge exactly once. Note: Repeated vertices are allowed.

• Exercise: Find an Euler path from A to D in the example graphs.

Q: Does every graph have an Euler path? Nope!

• Theorem: In an Euler path, either all or all but two vertices (i.e., the two endpoints) have an even degree.

A

C

B

D

E

A

C

B

D

E

Page 15: 1 Topics Paths and Circuits (11.2) A B C D E F G

15

Finding an Euler Path• Example 11.2.7

Correction: Remove the edge between node I and K in the graph on page 676.

Q: Find other Euler paths in the example graph.

Q: How many Euler paths are there?

Q: Is there an algorithm to find all the Euler paths in a given graph?

A

C

B

D

E

Exercise: Find all the Euler paths from A to D in this example graph.

Page 16: 1 Topics Paths and Circuits (11.2) A B C D E F G

16

Euler Circuits• p.671: Let G be a graph. An Euler

circuit for G is a circuit that contains every vertex and every edge of G.

Note: Although a vertex may be repeated, an edge may not be repeated in an Euler circuit.

Exercise: Find an Euler circuit starting with A in the example graphs.

Theorem 11.2.2 (p.671): If a graph G has an Euler circuit, then every vertex of G has even degree.

Theorem 11.2.3 (p.672): If every vertex of a nonempty connected graph G has even degree, then G has an Euler circuit.

A

C

B

D

E

A

C

B

D

E

Page 17: 1 Topics Paths and Circuits (11.2) A B C D E F G

17

Questions?