Graphs
Reading: EC 7.1–7.2 Peter J. Haas INFO 150 Fall Semester 2019
Lecture 15 1/ 21
Graphs Reading: EC 7.17.2 Peter J. Haas INFO 150 Fall Semester - - PowerPoint PPT Presentation
Graphs Reading: EC 7.17.2 Peter J. Haas INFO 150 Fall Semester 2019 Lecture 15 1/ 21 Graphs Introduction The K onigsberg Bridge Problem Definitions and Terminology Graph Notation for K onigsberg Problem Eulerian Graphs Graphs
Reading: EC 7.1–7.2 Peter J. Haas INFO 150 Fall Semester 2019
Lecture 15 1/ 21
Graphs Introduction The K¨
Definitions and Terminology Graph Notation for K¨
Eulerian Graphs Graphs with Eulerian Trails Proofs About Graphs
Lecture 15 2/ 21
You have already seen lots of graphs—we will now study their abstract properties
Lecture 15 3/ 21
2 3 4 a b c d 1 b c d 1 2 3 4 a
Directed graph
H H H H H H H T T T T HHH HHT HTH HTT THH HHT TTH TTT T T T
Tree
HS Friends College Friends Girlfriend's Friends University Friends
Other Academic Friends griffsgraphs.wordpress.com/2012/07/02/a-facebook-network/Facebook network Watson drug discovery
K¨
I Consider a walk around town: A, 6, B, 5, D, 4, A I Eulerian trail: Crosses each bridge once I Eulerian circuit: ... and comes back to starting point I Does there exist an Eulerian circuit?
Lecture 15 4/ 21
7 bridges of K¨
A B C D
Abstract 7 bridges of K¨
A B C D
1 2 3 4 5 6 7 K¨
K¨
I Consider a walk around town: A, 6, B, 5, D, 4, A I Eulerian trail: Crosses each bridge once I Eulerian circuit: ... and comes back to starting point I Does there exist an Eulerian circuit? Euler’s non-existence proof I Suppose A is an intermediate vertex (not starting or ending) I Bridges to A must come in pairs I So need an even number of edges I But every vertex has an odd number of edges I Hence none of the four regions can be an interior vertex I So Eulerian trail cannot exist
Lecture 15 4/ 21
7 bridges of K¨
A B C D
Abstract 7 bridges of K¨
A B C D
1 2 3 4 5 6 7 K¨
Proposition 1 In any graph, if there are an odd number of edges connected to a vertex x, then x cannot be an interior vertex of an Eulerian trail. Example: Explain why the following graph does not have an Eulerian trail
a b c d e f g h i j
Question: Can we give conditions under which there exists an Eulerian trail?
Lecture 15 5/ 21
,
h
, j
have odd # OP
Definitions
I An edge is associated with one or two vertices, called endpoints. I Two nodes joined by an edge are called adjacent nodes. I An edge with one vertex is called a loop. I Two edges having the same endpoints are called multiple edges or parallel edges.
I Each edge in the list lies between its endpoints. I If beginning and end vertices are the same, the walk is closed. I The length of a walk is the number of edges (n in the above example). I A walk of length 0 is called a trivial walk.
I A circuit is a closed trail I A circuit having one vertex and no edges is called a trivial circuit. I A trail or circuit is Eulerian if it uses every edge in the graph. I A cycle is a nontrivial circuit in which the only repeated node is the first/last one. Lecture 15 6/ 21
A B C 1 2 3 4 5
(a) B, 5, C, 5, B, 2, A, 2, B is a closed walk that repeats edge 5 (so not a trail) (b) A, 2, B, 5, C is a path (no repeated vertices) (c) B is a trivial walk and a trivial circuit (d) A, 1, A, 2, B, 5, C, 3, A is a circuit starting and ending at A (e) A, 2, B, 5, C, 3, A, 1, A, 4, C is an Eulerian trail (f) The first part of (e), A, 2, B, 5, C, 3, A, is a cycle—unlike (d), node A appears
Challenge: Add one edge to the graph to create an Eulerian circuit
Lecture 15 7/ 21
The graph that you use depends upon the application
Madrid Rome London Paris Madrid Rome London Paris
702 812 31 3913 17 271 1703 2321 117 3421
G1: Simple Graph G2: Directed Graph with Parallel Edges
Flight planning I How do I get from Madrid to London? (G1 or G2)
I Note: For G1, it suffices just to list the sequence of vertices
I What flights will take me from Madrid to London? (G2)
Lecture 15 8/ 21
Definitions
Madrid Rome London Paris Madrid Rome London Paris
702 812 31 3913 17 271 1703 2321 117 3421
G1: Simple Graph G2: Directed Graph with Parallel Edges
Examples I G1 edges are: [Madrid, Paris], [London, Paris], [Madrid, Rome], [Paris, Rome] I G2 directed edges include: (Rome, Paris), (Paris, Rome), (Rome, Madrid) I Note: There is never any ambiguity in a simple graph
Lecture 15 9/ 21
Definitions
endpoint of an edge. (It equals the number of edges that are incident with v, except that loops are counted twice.)
nodes and edges in G.
that no other connected subgraph of G containing H exists.
Lecture 15 10/ 21
e-
Definitions
endpoint of an edge. (It equals the number of edges that are incident with v, except that loops are counted twice.)
nodes and edges in G.
that no other connected subgraph of G containing H exists. Example I The degree of node 3 is 4: it appears in [1, 3], [3, 2], [5, 3], and [3, 4]. The degree of node 6 is 3 I There is no walk from node 4 to node 6, so the graph is not connected I The graph has two connected components
Lecture 15 10/ 21
1 2 3 4 5 6 7 8
Definitions
endpoint of an edge. (It equals the number of edges that are incident with v, except that loops are counted twice.)
nodes and edges in G.
that no other connected subgraph of G containing H exists. Example I What is the degree of node 1? I Find an Eulerian trail in the component on the right I Find an Eulerian circuit in the component on the left I Is the red subgraph a connected component?
Lecture 15 11/ 21
1 2 3 4 5 6 7 8
.
Definition A graph G is Eulerian if it contains an Eulerian circuit. Theorem 2 Let G be a connected graph. The graph G is Eulerian if and only if every node in G has even degree. The proof of this theorem uses induction. The basic ideas are illustrated in the next
finding Eulerian circuits in several smaller graphs.
Lecture 15 12/ 21
Given a connected graph G with all nodes of even degree:
circuit C
Lecture 15 13/ 21
7 3 4 5 6 8 9 10 14 12 13 11 7 1 2 3 4 5 6 8 9 10 14 12 13 11 7 1 2 3 8 14 11
Given a connected graph G with all nodes of even degree:
circuit C
Lecture 15 13/ 21
7 3 4 5 6 8 9 10 14 12 13 11 7 1 2 3 4 5 6 8 9 10 14 12 13 11 7 1 2 3 8 14 11
Given a connected graph G with all nodes of even degree:
circuit C
(a) H1 has an Eulerian circuit C1 = 3, 4, 5, 6, 7, 11, 12, 13, 6, 3, 11, 13, 14, 3 (b) H2 has an Eulerian circuit C2 = 8, 9, 10, 8
Lecture 15 13/ 21
7 3 4 5 6 8 9 10 14 12 13 11 7 1 2 3 4 5 6 8 9 10 14 12 13 11 7 1 2 3 8 14 11
Given a connected graph G with all nodes of even degree:
circuit C
(a) H1 has an Eulerian circuit C1 = 3, 4, 5, 6, 7, 11, 12, 13, 6, 3, 11, 13, 14, 3 (b) H2 has an Eulerian circuit C2 = 8, 9, 10, 8
I In C, replace 3 with C1 and 8 with C2:
1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 6, 3, 11, 13, 14, 3 | {z }, 7, 8, 9, 10, 8 | {z }, 11, 14, 1
Lecture 15 13/ 21
7 3 4 5 6 8 9 10 14 12 13 11 7 1 2 3 4 5 6 8 9 10 14 12 13 11 7 1 2 3 8 14 11
Given a connected graph G with all nodes of even degree:
circuit C
(a) H1 has an Eulerian circuit C1 = 3, 4, 5, 6, 7, 11, 12, 13, 6, 3, 11, 13, 14, 3 (b) H2 has an Eulerian circuit C2 = 8, 9, 10, 8
I In C, replace 3 with C1 and 8 with C2:
1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 6, 3, 11, 13, 14, 3 | {z }, 7, 8, 9, 10, 8 | {z }, 11, 14, 1
Lecture 15 13/ 21
7 3 4 5 6 8 9 10 14 12 13 11 7 1 2 3 4 5 6 8 9 10 14 12 13 11 7 1 2 3 8 14 11
We can apply this idea recursively!
Can you draw the figure without lifting pencil from paper or retracing a line? I Same as asking: Can you find an Eulerian trail? I We are not asking if graph is Eulerian (we’re not trying to find a circuit)
Lecture 15 14/ 21
Theorem 3 In any graph, the sum of the degrees of the vertices is equal to twice the number of
i=1 deg(vi) = 2m, where v1, v2, . . . , vn are the vertices and m is the
number of edges.
Lecture 15 15/ 21
Theorem 3 In any graph, the sum of the degrees of the vertices is equal to twice the number of
i=1 deg(vi) = 2m, where v1, v2, . . . , vn are the vertices and m is the
number of edges. Proof: I Each edge has two end points (not necessarily distinct) I Degree of a node counts # of times it appears as endpoint of an edge I So when summing the degrees of nodes, we count each edge exactly twice
Lecture 15 15/ 21
Theorem 3 In any graph, the sum of the degrees of the vertices is equal to twice the number of
i=1 deg(vi) = 2m, where v1, v2, . . . , vn are the vertices and m is the
number of edges. Proof: I Each edge has two end points (not necessarily distinct) I Degree of a node counts # of times it appears as endpoint of an edge I So when summing the degrees of nodes, we count each edge exactly twice Corollary 4 In any graph, the number of nodes with odd degree is even.
Lecture 15 15/ 21
Theorem 3 In any graph, the sum of the degrees of the vertices is equal to twice the number of
i=1 deg(vi) = 2m, where v1, v2, . . . , vn are the vertices and m is the
number of edges. Proof: I Each edge has two end points (not necessarily distinct) I Degree of a node counts # of times it appears as endpoint of an edge I So when summing the degrees of nodes, we count each edge exactly twice Corollary 4 In any graph, the number of nodes with odd degree is even. Proof: I The sum of two evens is even, sum of two odds is even, sum of even and odd is odd I When calculating sum of all node degrees, the even numbers sum to an even number I By Theorem 3, all the numbers sum to an even number I Therefore, the odd numbers sum to an even number I Therefore, there must be an even number of these
Lecture 15 15/ 21
Theorem 5 A connected, non-Eulerian graph G has an Eulerian trail if and only if G has exactly two nodes of odd degree. The train must begin and end at these nodes.
Lecture 15 16/ 21
4 5 6 1 2 3 C = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4, 3 T = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4
Theorem 5 A connected, non-Eulerian graph G has an Eulerian trail if and only if G has exactly two nodes of odd degree. The train must begin and end at these nodes. Proof: I Suppose that G is a connected graph that is not Eulerian but has an Eulerian trail from v to w
Lecture 15 16/ 21
4 5 6 1 2 3 C = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4, 3 T = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4
Theorem 5 A connected, non-Eulerian graph G has an Eulerian trail if and only if G has exactly two nodes of odd degree. The train must begin and end at these nodes. Proof: I Suppose that G is a connected graph that is not Eulerian but has an Eulerian trail from v to w
I By Proposition 1, every node (except maybe v and w) has even degree Lecture 15 16/ 21
4 5 6 1 2 3 C = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4, 3 T = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4
Theorem 5 A connected, non-Eulerian graph G has an Eulerian trail if and only if G has exactly two nodes of odd degree. The train must begin and end at these nodes. Proof: I Suppose that G is a connected graph that is not Eulerian but has an Eulerian trail from v to w
I By Proposition 1, every node (except maybe v and w) has even degree I Since graph is non-Eulerian, at least one node has odd degree (Theorem 2) Lecture 15 16/ 21
4 5 6 1 2 3 C = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4, 3 T = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4
Theorem 5 A connected, non-Eulerian graph G has an Eulerian trail if and only if G has exactly two nodes of odd degree. The train must begin and end at these nodes. Proof: I Suppose that G is a connected graph that is not Eulerian but has an Eulerian trail from v to w
I By Proposition 1, every node (except maybe v and w) has even degree I Since graph is non-Eulerian, at least one node has odd degree (Theorem 2) I Therefore, at least two nodes have odd degree (Corollary 4) Lecture 15 16/ 21
4 5 6 1 2 3 C = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4, 3 T = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4
Theorem 5 A connected, non-Eulerian graph G has an Eulerian trail if and only if G has exactly two nodes of odd degree. The train must begin and end at these nodes. Proof: I Suppose that G is a connected graph that is not Eulerian but has an Eulerian trail from v to w
I By Proposition 1, every node (except maybe v and w) has even degree I Since graph is non-Eulerian, at least one node has odd degree (Theorem 2) I Therefore, at least two nodes have odd degree (Corollary 4) I These nodes must be v and w Lecture 15 16/ 21
4 5 6 1 2 3 C = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4, 3 T = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4
Theorem 5 A connected, non-Eulerian graph G has an Eulerian trail if and only if G has exactly two nodes of odd degree. The train must begin and end at these nodes. Proof: I Suppose that G is a connected graph that is not Eulerian but has an Eulerian trail from v to w
I By Proposition 1, every node (except maybe v and w) has even degree I Since graph is non-Eulerian, at least one node has odd degree (Theorem 2) I Therefore, at least two nodes have odd degree (Corollary 4) I These nodes must be v and w
I Now suppose that G is a connected graph with exactly two nodes, x and y, of odd degree
Lecture 15 16/ 21
4 5 6 1 2 3 C = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4, 3 T = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4
Theorem 5 A connected, non-Eulerian graph G has an Eulerian trail if and only if G has exactly two nodes of odd degree. The train must begin and end at these nodes. Proof: I Suppose that G is a connected graph that is not Eulerian but has an Eulerian trail from v to w
I By Proposition 1, every node (except maybe v and w) has even degree I Since graph is non-Eulerian, at least one node has odd degree (Theorem 2) I Therefore, at least two nodes have odd degree (Corollary 4) I These nodes must be v and w
I Now suppose that G is a connected graph with exactly two nodes, x and y, of odd degree
I Form G 0 by adding the edge [x, y] to G Lecture 15 16/ 21
4 5 6 1 2 3 C = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4, 3 T = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4
Theorem 5 A connected, non-Eulerian graph G has an Eulerian trail if and only if G has exactly two nodes of odd degree. The train must begin and end at these nodes. Proof: I Suppose that G is a connected graph that is not Eulerian but has an Eulerian trail from v to w
I By Proposition 1, every node (except maybe v and w) has even degree I Since graph is non-Eulerian, at least one node has odd degree (Theorem 2) I Therefore, at least two nodes have odd degree (Corollary 4) I These nodes must be v and w
I Now suppose that G is a connected graph with exactly two nodes, x and y, of odd degree
I Form G 0 by adding the edge [x, y] to G I All nodes in G 0 have even degree, so G 0 has an Eulerian circuit (Theorem 2) Lecture 15 16/ 21
4 5 6 1 2 3 C = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4, 3 T = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4
Theorem 5 A connected, non-Eulerian graph G has an Eulerian trail if and only if G has exactly two nodes of odd degree. The train must begin and end at these nodes. Proof: I Suppose that G is a connected graph that is not Eulerian but has an Eulerian trail from v to w
I By Proposition 1, every node (except maybe v and w) has even degree I Since graph is non-Eulerian, at least one node has odd degree (Theorem 2) I Therefore, at least two nodes have odd degree (Corollary 4) I These nodes must be v and w
I Now suppose that G is a connected graph with exactly two nodes, x and y, of odd degree
I Form G 0 by adding the edge [x, y] to G I All nodes in G 0 have even degree, so G 0 has an Eulerian circuit (Theorem 2) I Deleting edge [x, y] from the circuit gives an Eulerian trail in G from x to y Lecture 15 16/ 21
4 5 6 1 2 3 C = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4, 3 T = 3, 2, 1, 5, 4, 6, 2, 5, 6, 3, 4
We will look at two example proofs I A direct proof I An inductive proof of Theorem 2 We will use the techniques that we have learned, but in a new, slightly more complicated context
Lecture 15 17/ 21
Proposition 4 For every connected graph G with at least one edge, if G has no cycles, then G has at least one vertex of degree 1.
Lecture 15 18/ 21
Proposition 40 (Contrapositive) For every connected graph G with at least one edge, if every vertex is of degree at least 2, then G has a cycle. Proof I Let G be a connected graph with at least one edge and every vertex of degree ≥ 2. Let n be the number of vertices in G, and choose v0 to be any vertex in G.
Lecture 15 19/ 21
Proposition 40 (Contrapositive) For every connected graph G with at least one edge, if every vertex is of degree at least 2, then G has a cycle. Proof I Let G be a connected graph with at least one edge and every vertex of degree ≥ 2. Let n be the number of vertices in G, and choose v0 to be any vertex in G. I Choose vertices to build a walk:
Lecture 15 19/ 21
Proposition 40 (Contrapositive) For every connected graph G with at least one edge, if every vertex is of degree at least 2, then G has a cycle. Proof I Let G be a connected graph with at least one edge and every vertex of degree ≥ 2. Let n be the number of vertices in G, and choose v0 to be any vertex in G. I Choose vertices to build a walk:
I Since v0 has degree ≥ 2, we can pick v1 to be the other endpoint of an
edge incident with v0.
Lecture 15 19/ 21
Proposition 40 (Contrapositive) For every connected graph G with at least one edge, if every vertex is of degree at least 2, then G has a cycle. Proof I Let G be a connected graph with at least one edge and every vertex of degree ≥ 2. Let n be the number of vertices in G, and choose v0 to be any vertex in G. I Choose vertices to build a walk:
I Since v0 has degree ≥ 2, we can pick v1 to be the other endpoint of an
edge incident with v0.
I Since v1 has degree ≥ 2, we can pick v2 to be the other endpoint of an
edge incident with v1 other than [v0, v1].
Lecture 15 19/ 21
Proposition 40 (Contrapositive) For every connected graph G with at least one edge, if every vertex is of degree at least 2, then G has a cycle. Proof I Let G be a connected graph with at least one edge and every vertex of degree ≥ 2. Let n be the number of vertices in G, and choose v0 to be any vertex in G. I Choose vertices to build a walk:
I Since v0 has degree ≥ 2, we can pick v1 to be the other endpoint of an
edge incident with v0.
I Since v1 has degree ≥ 2, we can pick v2 to be the other endpoint of an
edge incident with v1 other than [v0, v1].
I Since v2 has degree ≥ 2, we can pick v3 to be the other endpoint of an
edge incident with v2 other than [v1, v2].
Lecture 15 19/ 21
Proposition 40 (Contrapositive) For every connected graph G with at least one edge, if every vertex is of degree at least 2, then G has a cycle. Proof I Let G be a connected graph with at least one edge and every vertex of degree ≥ 2. Let n be the number of vertices in G, and choose v0 to be any vertex in G. I Choose vertices to build a walk:
I Since v0 has degree ≥ 2, we can pick v1 to be the other endpoint of an
edge incident with v0.
I Since v1 has degree ≥ 2, we can pick v2 to be the other endpoint of an
edge incident with v1 other than [v0, v1].
I Since v2 has degree ≥ 2, we can pick v3 to be the other endpoint of an
edge incident with v2 other than [v1, v2].
I ...and so on, until vertex vn has been chosen. Lecture 15 19/ 21
Proposition 40 (Contrapositive) For every connected graph G with at least one edge, if every vertex is of degree at least 2, then G has a cycle. Proof I Let G be a connected graph with at least one edge and every vertex of degree ≥ 2. Let n be the number of vertices in G, and choose v0 to be any vertex in G. I Choose vertices to build a walk:
I Since v0 has degree ≥ 2, we can pick v1 to be the other endpoint of an
edge incident with v0.
I Since v1 has degree ≥ 2, we can pick v2 to be the other endpoint of an
edge incident with v1 other than [v0, v1].
I Since v2 has degree ≥ 2, we can pick v3 to be the other endpoint of an
edge incident with v2 other than [v1, v2].
I ...and so on, until vertex vn has been chosen.
I This walk uses n + 1 vertices, but G only has n vertices, so there must be a first value j such that vi = vj for some i < j. (The “pigeonhole principle”.)
Lecture 15 19/ 21
Proposition 40 (Contrapositive) For every connected graph G with at least one edge, if every vertex is of degree at least 2, then G has a cycle. Proof I Let G be a connected graph with at least one edge and every vertex of degree ≥ 2. Let n be the number of vertices in G, and choose v0 to be any vertex in G. I Choose vertices to build a walk:
I Since v0 has degree ≥ 2, we can pick v1 to be the other endpoint of an
edge incident with v0.
I Since v1 has degree ≥ 2, we can pick v2 to be the other endpoint of an
edge incident with v1 other than [v0, v1].
I Since v2 has degree ≥ 2, we can pick v3 to be the other endpoint of an
edge incident with v2 other than [v1, v2].
I ...and so on, until vertex vn has been chosen.
I This walk uses n + 1 vertices, but G only has n vertices, so there must be a first value j such that vi = vj for some i < j. (The “pigeonhole principle”.) I The cycle is then C = vi, vi+1, vi+2, . . . , vj.
Lecture 15 19/ 21
Theorem 2 Let G be a connected graph with at least one edge. The graph G is Eulerian if and
Lecture 15 20/ 21
Theorem 2 Let G be a connected graph with at least one edge. The graph G is Eulerian if and
Lecture 15 20/ 21
Theorem 2 Let G be a connected graph with at least one edge. The graph G is Eulerian if and
I Suppose G has an Eulerian circuit, and let x be any node in the graph Lecture 15 20/ 21
Theorem 2 Let G be a connected graph with at least one edge. The graph G is Eulerian if and
I Suppose G has an Eulerian circuit, and let x be any node in the graph I Write the Eulerian circuit as a walk v1e1v2e2 · · · vnenv1 Lecture 15 20/ 21
Theorem 2 Let G be a connected graph with at least one edge. The graph G is Eulerian if and
I Suppose G has an Eulerian circuit, and let x be any node in the graph I Write the Eulerian circuit as a walk v1e1v2e2 · · · vnenv1 I Since G is connected, x must be one of the vertices in the walk Lecture 15 20/ 21
Theorem 2 Let G be a connected graph with at least one edge. The graph G is Eulerian if and
I Suppose G has an Eulerian circuit, and let x be any node in the graph I Write the Eulerian circuit as a walk v1e1v2e2 · · · vnenv1 I Since G is connected, x must be one of the vertices in the walk I Each time (if any) that x appears in the middle of the walk, it is the endpoint for
two different edges
Lecture 15 20/ 21
Theorem 2 Let G be a connected graph with at least one edge. The graph G is Eulerian if and
I Suppose G has an Eulerian circuit, and let x be any node in the graph I Write the Eulerian circuit as a walk v1e1v2e2 · · · vnenv1 I Since G is connected, x must be one of the vertices in the walk I Each time (if any) that x appears in the middle of the walk, it is the endpoint for
two different edges
I If x = v1, then it is the endpoint for e1 and en Lecture 15 20/ 21
Theorem 2 Let G be a connected graph with at least one edge. The graph G is Eulerian if and
I Suppose G has an Eulerian circuit, and let x be any node in the graph I Write the Eulerian circuit as a walk v1e1v2e2 · · · vnenv1 I Since G is connected, x must be one of the vertices in the walk I Each time (if any) that x appears in the middle of the walk, it is the endpoint for
two different edges
I If x = v1, then it is the endpoint for e1 and en I So the degree of x is even Lecture 15 20/ 21
Theorem 2 Let G be a connected graph with at least one edge. The graph G is Eulerian if and
I Suppose G has an Eulerian circuit, and let x be any node in the graph I Write the Eulerian circuit as a walk v1e1v2e2 · · · vnenv1 I Since G is connected, x must be one of the vertices in the walk I Each time (if any) that x appears in the middle of the walk, it is the endpoint for
two different edges
I If x = v1, then it is the endpoint for e1 and en I So the degree of x is even
Lecture 15 20/ 21
Theorem 2 Let G be a connected graph with at least one edge. The graph G is Eulerian if and
I Suppose G has an Eulerian circuit, and let x be any node in the graph I Write the Eulerian circuit as a walk v1e1v2e2 · · · vnenv1 I Since G is connected, x must be one of the vertices in the walk I Each time (if any) that x appears in the middle of the walk, it is the endpoint for
two different edges
I If x = v1, then it is the endpoint for e1 and en I So the degree of x is even
I P(1) is trivially true (only such graph exists) Lecture 15 20/ 21 ~ a
loop
Theorem 2 Let G be a connected graph with at least one edge. The graph G is Eulerian if and
I Suppose G has an Eulerian circuit, and let x be any node in the graph I Write the Eulerian circuit as a walk v1e1v2e2 · · · vnenv1 I Since G is connected, x must be one of the vertices in the walk I Each time (if any) that x appears in the middle of the walk, it is the endpoint for
two different edges
I If x = v1, then it is the endpoint for e1 and en I So the degree of x is even
I P(1) is trivially true (only such graph exists) I Assume P(1), . . . P(m − 1) all hold, and consider a graph G with m edges Lecture 15 20/ 21
Theorem 2 Let G be a connected graph with at least one edge. The graph G is Eulerian if and
I Suppose G has an Eulerian circuit, and let x be any node in the graph I Write the Eulerian circuit as a walk v1e1v2e2 · · · vnenv1 I Since G is connected, x must be one of the vertices in the walk I Each time (if any) that x appears in the middle of the walk, it is the endpoint for
two different edges
I If x = v1, then it is the endpoint for e1 and en I So the degree of x is even
I P(1) is trivially true (only such graph exists) I Assume P(1), . . . P(m − 1) all hold, and consider a graph G with m edges I By Proposition 40, there is a cycle C in G Lecture 15 20/ 21
Theorem 2 Let G be a connected graph with at least one edge. The graph G is Eulerian if and
I Suppose G has an Eulerian circuit, and let x be any node in the graph I Write the Eulerian circuit as a walk v1e1v2e2 · · · vnenv1 I Since G is connected, x must be one of the vertices in the walk I Each time (if any) that x appears in the middle of the walk, it is the endpoint for
two different edges
I If x = v1, then it is the endpoint for e1 and en I So the degree of x is even
I P(1) is trivially true (only such graph exists) I Assume P(1), . . . P(m − 1) all hold, and consider a graph G with m edges I By Proposition 40, there is a cycle C in G I Form graph G 0 by removing the edges in C Lecture 15 20/ 21
Theorem 2 Let G be a connected graph with at least one edge. The graph G is Eulerian if and
I Suppose G has an Eulerian circuit, and let x be any node in the graph I Write the Eulerian circuit as a walk v1e1v2e2 · · · vnenv1 I Since G is connected, x must be one of the vertices in the walk I Each time (if any) that x appears in the middle of the walk, it is the endpoint for
two different edges
I If x = v1, then it is the endpoint for e1 and en I So the degree of x is even
I P(1) is trivially true (only such graph exists) I Assume P(1), . . . P(m − 1) all hold, and consider a graph G with m edges I By Proposition 40, there is a cycle C in G I Form graph G 0 by removing the edges in C I Each connected component H1, . . . , Hk has nodes of even degree and—by
inductive assumption—has an Eulerian circuit C1, . . . , Ck
Lecture 15 20/ 21
Theorem 2 Let G be a connected graph with at least one edge. The graph G is Eulerian if and
I Suppose G has an Eulerian circuit, and let x be any node in the graph I Write the Eulerian circuit as a walk v1e1v2e2 · · · vnenv1 I Since G is connected, x must be one of the vertices in the walk I Each time (if any) that x appears in the middle of the walk, it is the endpoint for
two different edges
I If x = v1, then it is the endpoint for e1 and en I So the degree of x is even
I P(1) is trivially true (only such graph exists) I Assume P(1), . . . P(m − 1) all hold, and consider a graph G with m edges I By Proposition 40, there is a cycle C in G I Form graph G 0 by removing the edges in C I Each connected component H1, . . . , Hk has nodes of even degree and—by
inductive assumption—has an Eulerian circuit C1, . . . , Ck
I Each of these must meet C, say, at v1, v2, . . . , vk Lecture 15 20/ 21
Theorem 2 Let G be a connected graph with at least one edge. The graph G is Eulerian if and
I Suppose G has an Eulerian circuit, and let x be any node in the graph I Write the Eulerian circuit as a walk v1e1v2e2 · · · vnenv1 I Since G is connected, x must be one of the vertices in the walk I Each time (if any) that x appears in the middle of the walk, it is the endpoint for
two different edges
I If x = v1, then it is the endpoint for e1 and en I So the degree of x is even
I P(1) is trivially true (only such graph exists) I Assume P(1), . . . P(m − 1) all hold, and consider a graph G with m edges I By Proposition 40, there is a cycle C in G I Form graph G 0 by removing the edges in C I Each connected component H1, . . . , Hk has nodes of even degree and—by
inductive assumption—has an Eulerian circuit C1, . . . , Ck
I Each of these must meet C, say, at v1, v2, . . . , vk I “Insert” each Ci into C to obtain desired circuit
(Arrange C to start and end at vi and write Ci in place of vi in C)
Lecture 15 20/ 21
Lecture 15 21/ 21
7 3 4 5 6 8 9 10 14 12 13 11 7 1 2 3 4 5 6 8 9 10 14 12 13 11 7 1 2 3 8 14 11