Comp 150GT: Prof. Diane Souvaine Tufts University, Oct. 17 2019 Scribe: Riley Price

Lecture 7: Euler’s Formula and Matchings

1 Data Structures for Planar Graphs

Last time, we discussed data structures for graphs. Major ideas discussed were

• The doubly connected edge list. In this structure, we represent each edge as two “half-edges”. Each face points to any of its bounding half-edges, each vertex points to any incident half-edge, and each half- edge points to the unique face it bounds, to the next and previous edges around the face boundary, and to its twin edge.

• The winged edge data structure, which keeps track of 8 things for every edge e: the edge’s two endpoints, the two faces that each edge bounds, and, at each endpoint, the edges immediately clockwise and counterclockwise of e (four edges in total).

• The quad edge data structure. This one is fancy: it represents simul- taneously a graph, its dual, and its mirror image. This stackexchange thread offers a good overview, with pictures, of how the structure works.

2 The Euler Characteristic for Graphs

Definition 2.0.1 Let G be a plane graph, with F a face of G. The length of a face F is the total length of the closed walks in G bounding f.

Note that a cut-edge e can only belong to one face; otherwise, we’d be able to find a , and then e couldn’t be a cut-edge.

1 Proposition 2.0.2 Denote the length of a face Fi in a plane graph G by `(Fi). Then X 2e(G) = `(Fi) i

We omit a formal proof of Proposiion 2.0.2, but it’s not too hard to see why it’s true. The face lengths are the degrees of the dual vertices, and |E(G)| = |E(G∗)|, so this is just the -sum formula in disguise (cf. the proof of Proposition 6.1.13 in the book).

Definition 2.0.3 A bond is a minimal non-empty edge cut.

This definition gives us a surprising result.

Theorem 2.0.4 Edges in a plane graph G form a cycle if and only if the corresponding dual edges form a bond in G∗.

Proof: Omitted. See the proof of theorem 6.1.14 in West. It’s on Page 238 in my edition. We also presented this result for plane graphs.

Theorem 2.0.5 For a plane graph G, the following are equivalent.

• G is bipartite.

• Every face of G has even length.

• G∗ is Eulerian.

Proof: Omitted in class. See proof of Theorem 6.1.16 in West (Page 239 of my book).

As a fun aside to the following, people look at a lot of funky embeddings. For a cool example, see the Wikipedia page on Book embeddings.

2 Figure 1: K4 (left) and K2,3 (right)

Definition 2.0.6 An outerplanar graph has a planar embedding with ex- ery vertex on the outer face. An outerplane graph is an embedding that realizes an outerplanar graph.

Some remarks about outerplanar graphs

1. The boundary of the outer face of a 2-connected outer is a spanning cycle.

2. The graphs K4 and K2,3 are both planar, but not outer planar. 3. Every simple outer planar graph has a vertex of degree at most 2.

To understand the first proposition, recall that a graph is said to be k- connected if there is no set of k − 1 vertices whose deletion would disconnect the graph. Since the boundary of an outerplane graph contains all the ver- tices, then if it’s not a cycle it must pass through some vertex more than once. Such a vertex would be a cut-vertex.

To show that K4 and K2,3 (pictured in Figure 1) are not outerplanar, observe that they are 2-conencted. There can be no spanning cycle in K2,3 since such a cycle would be a cycle of length 5 in a bipartite graph, so we can conclude it is not outerplanaer by Remark 1. Remark 3 follows as a consequence of the two-ears theorem. An alternative proof that does not rely on the two-ears theorem can be found on page 240 of West (Proposition 6.1.20).

3 Now we present a basic counting tool relating vertices, edges, and faces in planar graphs.

Theorem 2.0.7 (Euler) If a connected plane graph G has exactly n vertices, e edges, and f faces then n − e + f = 2

Proof: We use induction on n. If n = 1, then G is a “flower”, since every edge is a loop. If e = 0, then f = 1 and the formula is true. Adding a loop will cut and face in two (by the Jordan Curve Theorem), which adds one to both the edge count and the face count, changes that cancel each other out. Thus the formula is always true for n = 1. If n > 1, since G is connected, we can find a non-loop edge in G. Contracting such an edge yields a new graph G0 with one less vertex than G, one less edge than G, and the same number of faces as G. The new graph G0 will have n0 = n − 1 vertices and e0 = e − 1 edges. Inductively, we know n0 − e0 + f = 2 but then (n − 1) − (e − 1) + f = 2 thus showing that Euler’s formula is true.

Euler’s formula has several corollaries.

Proposition 2.0.8 If G is a simple planar graph with at least 3 vertices then e ≤ 3n − 6.

Proof: Recall that if G is a simple planar graph with n ≥ 3 then every face Fi has length `(Fi) ≥ 3. Let fi = `(Fi). Since every face counts two edges (Prop. 6.1.13 in the book) we have X 2e = fi ≥ 3f i Or, dividing by 3 2 e ≥ f 3 4 Substituting the inequality into Euler’s formula gets 2 e ≤ n + e − 2 3 which we rearrange to conclude

e ≤ 3n − 6

We can apply Euler’s formula again to substitute n + f − 2 for e in the above and rearrange to get f ≤ 2n − 4

Proposition 2.0.9 If G is a simple, triangle-free graph with n ≥ 3 then

e ≤ 2n − 4

Proof: If G is triangle free, then every face has a minumum of four edges. Hence X 2e = fi ≥ 4f i Plugging in to Euler’s formula, we get 1 e ≤ n + e − 2 2 which we rearrange to get e ≤ 2n − 4 our desired result.

3 Matchings

Matchings are an abstraction of the idea of “pairing things together.” In real life, this happens often: for example, we might want to pair potential roommates or pair jobs with job-seekers. Every roommate gets one other roommate, every job gets one job-seeker and every job-seeker, one job. For- mally,

5 Definition 3.0.1 A matching M for a graph G is a set of non-loop edges with no shared endpoints. Vertices incident to the edges of M are said to be saturated by M, and those that are not are unsaturated by M.A perfect matching saturates every vertex.

Example 3.0.2 How many perfect matchings does Kn,n have?

It’s not too hard to see that Kn,n has n! perfect matchings. We have n choices to pair the first element in one of the partite sets, then n − 1 for the second element, and so on, until we have 1 choice for the final element.

Example 3.0.3 Suppose we looked at a clique?

Clearly an odd clique can’t have any perfect matchings, but how many perfect matchings are there in K2n? Let fn be the number of perfect matchings in K2n. We can observe the following recusrsive formula must hold.

fn = (2n − 1)fn−1, f0 = 1 This is because there are 2n − 11 choices for the partner of the first vertex, and after making that choice the problem reduces to the number of perfect matchings on K2n−2. If we expand this relationship, we’ll get (2n)! (2n − 1) · (2n − 3) ... 5 · 3 · 1 = 2nn! We can derive this formula using another relationship, by

• First, order the 2n people. There are (2n)! ways to do thos. • Then, pair them in order. Relative order is irrelevant so divide by 2n. • Finally, the order of the pairs is irrelevant, so divide by n!.

As an exercise, try counting the number of perfect matchings in the Pe- tersen graph.

When perfect matchings don’t exist

Neither of the graphs depicted in Figures 2 or 3 have perfect matchings.

6 Figure 2: No perfect matching

Figure 3: Also no perfect matching

7 If we have a matching M that’s maximal but not maximum, we look for an augmenting path, which is one where we can find M-alternating segments. (Recall that M is maximal if it cannot be extended, and maximum of no larger matching exists.)

Definition 3.0.4 Given a matching M, an M-alternating path is a path that alternates between edges in M and edges not in M. An M-augmenting path is an M-alternating path whose endpoints are not saturated by M.

Given an M-augmenting path P , we can replace the edges of M in P with the other edges of P to obtain a new matching M 0 with one more edge.

Definition 3.0.5 Let G be a graph, and consider two different matchings M, M 0 for G. The symmetric difference of M and M 0 is denoted by M∆M 0 and defined to be

M∆M 0 = (M − M 0) ∪ (M 0 − M)

We can characterize the components of the symmetric difference by the following lemma.

Lemma 3.0.6 Every component of the symmetric difference of two match- ings is a path or an even cycle.

Proof: Let F = M 0∆M. Since M and M 0 are both matchings, every vertex has at most one incident edge from each of them, so F has at most two edges at each vertex, which means every component of F is either a path or a cycle. Since a cycle must alternate between edges in (M −M 0) and edges in (M 0 − M), it must be even.

We use M-augmenting paths as a tool to characterize maximum match- ings.

Theorem 3.0.7 (Berge, 1957) A matching M in a graph G is a maximum matching in G if and only if G has no M-augmenting path.

8 Proof: We’ll prove the contrapositive for each direction. Firstly, observe that, if there exists an M-augmenting path, then we can clearly extend M along the path. Secondly, suppose that M is not a maximum matching in G, and there exists a matching M 0 such that |M 0| > |M|. Now we’ll construct an M-augmenting path using F = M∆M 0. If |M 0| > |M|, then F cannot consist entirely of cycles (which alternate between M and M 0). This means that there must exist a path in F that has more edges from M 0 than M. Since this path is alternating, it must start and end with edges from M 0. This is an M-augmenting path.

Theorem 3.0.8 (Hall) An X,Y-bigraph has a matching that saturates X iff

|N(S)| ≥ S, ∀S ⊂ X

We defer the proof of this theorem to next week.

9