13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed...

16
1 Euler circuit in directed graphs [Theorem] A directed graph has an Euler circuit iff: All vertices with nonzero degree belong to a single strongly connected component. In-degree and out-degree of every vertex is same. [Theorem] A directed graph has an Euler path iff at most one vertex has (out-degree) − (in-degree) = 1, at most one vertex has (in-degree) − (out-degree) = 1, every other vertex has equal in-degree and out-degree, and all of its vertices with nonzero degree belong to a single connected component of the underlying undirected graph. 13.6 Euler circuits and trails

Transcript of 13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed...

Page 1: 13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed graph has an Euler circuit iff: All vertices with nonzero degree belong to a single

1

Euler circuit in directed graphs

[Theorem] A directed graph has an Euler circuit iff:● All vertices with nonzero degree belong to a single

strongly connected component.● In-degree and out-degree of every vertex is same.

[Theorem] A directed graph has an Euler path iff ● at most one vertex has (out-degree) − (in-degree) = 1,

at most one vertex has (in-degree) − (out-degree) = 1,● every other vertex has equal in-degree and out-degree,

and ● all of its vertices with nonzero degree belong to a single

connected component of the underlying undirected graph.

13.6 Euler circuits and trails

Page 2: 13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed graph has an Euler circuit iff: All vertices with nonzero degree belong to a single

2

Euler circuit in directed graphs

[Theorem] A directed graph has an Euler circuit iff:● All vertices with nonzero degree belong to a single

strongly connected component.● In-degree and out-degree of every vertex is same.

13.6 Euler circuits and trails

a b

ef

c

d

Page 3: 13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed graph has an Euler circuit iff: All vertices with nonzero degree belong to a single

3

Euler circuit in directed graphs

[Theorem] A directed graph has an Euler circuit iff:● All vertices with nonzero degree belong to a single

strongly connected component.● In-degree and out-degree of every vertex is same.

13.6 Euler circuits and trails

a b

ef

c

d

deg-(a) = 2, deg+(a) = 2deg-(b) = 4, deg+(b) = 3STOP!No Euler circuit!

Page 4: 13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed graph has an Euler circuit iff: All vertices with nonzero degree belong to a single

4

Euler circuit in directed graphs

[Theorem] A directed graph has an Euler path iff ● at most one vertex has (out-degree) − (in-degree) = 1,

at most one vertex has (in-degree) − (out-degree) = 1,● every other vertex has in-degree = out-degree, and ● all of its vertices with nonzero degree belong to a single

connected component of the underlying undirected graph.

13.6 Euler circuits and trails

a b

ef

c

d

Page 5: 13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed graph has an Euler circuit iff: All vertices with nonzero degree belong to a single

5

Euler circuit in directed graphs

[Theorem] A directed graph has an Euler path iff ● at most one vertex has (out-degree) − (in-degree) = 1,

at most one vertex has (in-degree) − (out-degree) = 1,● every other vertex has in-degree = out-degree, and ● all of its vertices with nonzero degree belong to a single

connected component of the underlying undirected graph.

13.6 Euler circuits and trails

a b

ef

c

d

deg-(a) = 2, deg+(a) = 2deg-(b) = 4, deg+(b) = 3,

deg-(b) - deg+(b) = 1deg-(c) = 2, deg+(c) = 3,

deg+(c) - deg-(c) = 1deg-(d) = 2, deg+(d) = 2deg-(e) = 3, deg+(e) = 3deg-(f) = 3, deg+(f) = 3

graph has Euler path

Page 6: 13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed graph has an Euler circuit iff: All vertices with nonzero degree belong to a single

6

Euler circuit in directed graphs

[Theorem] A directed graph has an Euler path iff ● at most one vertex has (out-degree) − (in-degree) = 1,

at most one vertex has (in-degree) − (out-degree) = 1,● every other vertex has in-degree = out-degree, and ● all of its vertices with nonzero degree belong to a single

connected component of the underlying undirected graph.

13.6 Euler circuits and trails

a b

ef

c

d

deg-(a) = 2, deg+(a) = 2deg-(b) = 4, deg+(b) = 3,

deg-(b) - deg+(b) = 1deg-(c) = 2, deg+(c) = 3,

deg+(c) - deg-(c) = 1deg-(d) = 2, deg+(d) = 2deg-(e) = 3, deg+(e) = 3deg-(f) = 3, deg+(f) = 3

Page 7: 13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed graph has an Euler circuit iff: All vertices with nonzero degree belong to a single

7

Euler circuit in directed graphs

[Theorem] A directed graph has an Euler path iff ● at most one vertex has (out-degree) − (in-degree) = 1,

at most one vertex has (in-degree) − (out-degree) = 1,● every other vertex has in-degree = out-degree, and ● all of its vertices with nonzero degree belong to a single

connected component of the underlying undirected graph.

13.6 Euler circuits and trails

a b

ef

c

d

deg-(a) = 2, deg+(a) = 2deg-(b) = 4, deg+(b) = 3,

deg-(b) - deg+(b) = 1deg-(c) = 2, deg+(c) = 3,

deg+(c) - deg-(c) = 1deg-(d) = 2, deg+(d) = 2deg-(e) = 3, deg+(e) = 3deg-(f) = 3, deg+(f) = 3

Page 8: 13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed graph has an Euler circuit iff: All vertices with nonzero degree belong to a single

8

Euler circuit in directed graphs

[Theorem] A directed graph has an Euler path iff ● at most one vertex has (out-degree) − (in-degree) = 1,

at most one vertex has (in-degree) − (out-degree) = 1,● every other vertex has in-degree = out-degree, and ● all of its vertices with nonzero degree belong to a single

connected component of the underlying undirected graph.

13.6 Euler circuits and trails

a b

ef

c

d

deg-(a) = 2, deg+(a) = 2deg-(b) = 4, deg+(b) = 3,

deg-(b) - deg+(b) = 1deg-(c) = 2, deg+(c) = 3,

deg+(c) - deg-(c) = 1deg-(d) = 2, deg+(d) = 2deg-(e) = 3, deg+(e) = 3deg-(f) = 3, deg+(f) = 3

Page 9: 13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed graph has an Euler circuit iff: All vertices with nonzero degree belong to a single

9

Euler circuit in directed graphs

[Theorem] A directed graph has an Euler path iff ● at most one vertex has (out-degree) − (in-degree) = 1,

at most one vertex has (in-degree) − (out-degree) = 1,● every other vertex has in-degree = out-degree, and ● all of its vertices with nonzero degree belong to a single

connected component of the underlying undirected graph.

13.6 Euler circuits and trails

a b

ef

c

d

deg-(a) = 2, deg+(a) = 2deg-(b) = 4, deg+(b) = 3,

deg-(b) - deg+(b) = 1deg-(c) = 2, deg+(c) = 3,

deg+(c) - deg-(c) = 1deg-(d) = 2, deg+(d) = 2deg-(e) = 3, deg+(e) = 3deg-(f) = 3, deg+(f) = 3

Page 10: 13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed graph has an Euler circuit iff: All vertices with nonzero degree belong to a single

10

Euler circuit in directed graphs

[Theorem] A directed graph has an Euler path iff ● at most one vertex has (out-degree) − (in-degree) = 1,

at most one vertex has (in-degree) − (out-degree) = 1,● every other vertex has in-degree = out-degree, and ● all of its vertices with nonzero degree belong to a single

connected component of the underlying undirected graph.

13.6 Euler circuits and trails

a b

ef

c

d

deg-(a) = 2, deg+(a) = 2deg-(b) = 4, deg+(b) = 3,

deg-(b) - deg+(b) = 1deg-(c) = 2, deg+(c) = 3,

deg+(c) - deg-(c) = 1deg-(d) = 2, deg+(d) = 2deg-(e) = 3, deg+(e) = 3deg-(f) = 3, deg+(f) = 3

Page 11: 13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed graph has an Euler circuit iff: All vertices with nonzero degree belong to a single

11

Euler circuit in directed graphs

[Theorem] A directed graph has an Euler path iff ● at most one vertex has (out-degree) − (in-degree) = 1,

at most one vertex has (in-degree) − (out-degree) = 1,● every other vertex has in-degree = out-degree, and ● all of its vertices with nonzero degree belong to a single

connected component of the underlying undirected graph.

13.6 Euler circuits and trails

a b

ef

c

d

deg-(a) = 2, deg+(a) = 2deg-(b) = 4, deg+(b) = 3,

deg-(b) - deg+(b) = 1deg-(c) = 2, deg+(c) = 3,

deg+(c) - deg-(c) = 1deg-(d) = 2, deg+(d) = 2deg-(e) = 3, deg+(e) = 3deg-(f) = 3, deg+(f) = 3

Page 12: 13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed graph has an Euler circuit iff: All vertices with nonzero degree belong to a single

12

Euler circuit in directed graphs

[Theorem] A directed graph has an Euler path iff ● at most one vertex has (out-degree) − (in-degree) = 1,

at most one vertex has (in-degree) − (out-degree) = 1,● every other vertex has in-degree = out-degree, and ● all of its vertices with nonzero degree belong to a single

connected component of the underlying undirected graph.

13.6 Euler circuits and trails

a b

ef

c

d

deg-(a) = 2, deg+(a) = 2deg-(b) = 4, deg+(b) = 3,

deg-(b) - deg+(b) = 1deg-(c) = 2, deg+(c) = 3,

deg+(c) - deg-(c) = 1deg-(d) = 2, deg+(d) = 2deg-(e) = 3, deg+(e) = 3deg-(f) = 3, deg+(f) = 3

Page 13: 13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed graph has an Euler circuit iff: All vertices with nonzero degree belong to a single

13

Euler circuit in directed graphs

[Theorem] A directed graph has an Euler path iff ● at most one vertex has (out-degree) − (in-degree) = 1,

at most one vertex has (in-degree) − (out-degree) = 1,● every other vertex has in-degree = out-degree, and ● all of its vertices with nonzero degree belong to a single

connected component of the underlying undirected graph.

13.6 Euler circuits and trails

a b

ef

c

d

deg-(a) = 2, deg+(a) = 2deg-(b) = 4, deg+(b) = 3,

deg-(b) - deg+(b) = 1deg-(c) = 2, deg+(c) = 3,

deg+(c) - deg-(c) = 1deg-(d) = 2, deg+(d) = 2deg-(e) = 3, deg+(e) = 3deg-(f) = 3, deg+(f) = 3

Page 14: 13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed graph has an Euler circuit iff: All vertices with nonzero degree belong to a single

14

Euler circuit in directed graphs

[Theorem] A directed graph has an Euler path iff ● at most one vertex has (out-degree) − (in-degree) = 1,

at most one vertex has (in-degree) − (out-degree) = 1,● every other vertex has in-degree = out-degree, and ● all of its vertices with nonzero degree belong to a single

connected component of the underlying undirected graph.

13.6 Euler circuits and trails

a b

ef

c

d

deg-(a) = 2, deg+(a) = 2deg-(b) = 4, deg+(b) = 3,

deg-(b) - deg+(b) = 1deg-(c) = 2, deg+(c) = 3,

deg+(c) - deg-(c) = 1deg-(d) = 2, deg+(d) = 2deg-(e) = 3, deg+(e) = 3deg-(f) = 3, deg+(f) = 3

Page 15: 13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed graph has an Euler circuit iff: All vertices with nonzero degree belong to a single

15

Euler circuit in directed graphs

[Theorem] A directed graph has an Euler path iff ● at most one vertex has (out-degree) − (in-degree) = 1,

at most one vertex has (in-degree) − (out-degree) = 1,● every other vertex has in-degree = out-degree, and ● all of its vertices with nonzero degree belong to a single

connected component of the underlying undirected graph.

13.6 Euler circuits and trails

a b

ef

c

d

deg-(a) = 2, deg+(a) = 2deg-(b) = 4, deg+(b) = 3,

deg-(b) - deg+(b) = 1deg-(c) = 2, deg+(c) = 3,

deg+(c) - deg-(c) = 1deg-(d) = 2, deg+(d) = 2deg-(e) = 3, deg+(e) = 3deg-(f) = 3, deg+(f) = 3

Page 16: 13.6 Euler circuits and trails€¦ · 3 Euler circuit in directed graphs [Theorem] A directed graph has an Euler circuit iff: All vertices with nonzero degree belong to a single

16

Euler circuit in directed graphs

[Theorem] A directed graph has an Euler path iff ● at most one vertex has (out-degree) − (in-degree) = 1,

at most one vertex has (in-degree) − (out-degree) = 1,● every other vertex has in-degree = out-degree, and ● all of its vertices with nonzero degree belong to a single

connected component of the underlying undirected graph.

13.6 Euler circuits and trails

a b

ef

c

d

deg-(a) = 2, deg+(a) = 2deg-(b) = 4, deg+(b) = 3,

deg-(b) - deg+(b) = 1deg-(c) = 2, deg+(c) = 3,

deg+(c) - deg-(c) = 1deg-(d) = 2, deg+(d) = 2deg-(e) = 3, deg+(e) = 3deg-(f) = 3, deg+(f) = 3

graph has Euler path