# Comp 163 Week 12 notes

Week of April 11

### Planar graphs

Concept of faces in a graph

Euler's Formula for Planar Graphs, p 259 (also works for polyhedra, which are, as graphs, planar; see p 262) (stated last week but not proven)

• Adding an edge and a new "spike" vertex increments v and e, but not f
• Adding an edge that connects two existing vertices increments e and f, but not v

Theorem 4.3.1: K5 is not planar: done last week

Comment: We know each edge is shared between at most two faces, so B <= 2e. Assuming no spike vertices, it is in fact true that B=2e, but proving this is not easy.

Also, a contradiction is a contradiction. Being close (as in 21 is close to 20) does not help at all.

Theorem 4.3.2: K3,3 is not planar.

Note that each face now has a boundary of at least four edges.

Planar graphs can be drawn on the surface of a sphere, and vice-versa.

Theorem 4.3.4: There are exactly 5 regular polyhedra.

Non-graph version of the proof: faces must be regular polygons. This leaves only equilateral triangles, squares, and regular pentagons, as polygons with more sides cannot be stuck together in a 3D structure (regular hexagons can be stuck together but the result is planar).

For squares and pentagons, we can only have 3 faces meeting at a vertex. These result in the cube and the dodecahedron, respectively.

For equilateral triangles, we can have 3, 4 or 5 faces meeting at a vertex (6 is planar). These result in the tetrahedron, octahedron and icosahedron respectively.

### Graph Coloring

Proper vertex coloring: color each vertex so that no two vertices connected by an edge have the same color.

Chromatic number: minumum number of colors needed = 𝜒(G)

Complete graph Kn: Chromatic number = n

Bipartite graph: chromatic number = 2

Theorem 4.4.2: For any planar graph, the chromatic number is less than or equal to 4.

The proof is very hard!

Investigate! on page 269 and Example 4.4.3 on page 270: graph coloring in practice

A clique in a graph is a subgraph isomorphic to Kn; that is, a set of n vertices such that each pair is connected by an edge. The clique number of a graph is the size of the largest clique subgraph.

Fact: 𝜒(G) = chromatic number >= clique number.

That gives us a lower bound on the chromatic number. What about an upper bound?

Let 𝚫(G) be the maximum degree of any vertex of G.

Fact: 𝜒(G) <= 𝚫(G)+1. Proof: start at the vertex of degree 𝚫(G). We can color that vertex and all its 𝚫(G) neighbors with 𝚫(G)+1 colors. Furthermore, we can keep going! Consider a vertex v that is a neighbor of a vertex we have colored. Some of the neighbors of v are colored and some are not. We have enough colors that we can always choose a color for v that is different from the color of any neighbor.

How often is 𝜒(G) = 𝚫(G)+1? Two cases come to mind:

• The complete graph Kn, for which 𝜒(G) = n and 𝚫(G) = n-1
• An odd cycle, for which 𝜒(G) = 3 but 𝚫(G) = 2

Are there any other examples? Brooks' Theorem (p 272) says no.

For any graph G, 𝜒(G) <= 𝚫(G) unless G is one of the two examples above

Edge coloring:

Wednesday

### Euler Paths and Circuits

Euler path: traverse every edge exactly once.

An Euler path exists if and only iff there are at most two vertices of odd degree, in which case those vertices must be the start and stop points of the path. (If there are no vertices of odd degree, then the path can start and stop at the same vertex; that is, it is a circuit.)

Lemma: Given a graph with all nodes having even degree, and any vertex, we can find a circuit starting and ending at that vertex that traverses every edge at most once.

Proof: start at v and keep going as long as you can, or until you return to v. You can't be forced to stop at any vertex v1 other than v because there will always be at least one remaining edge out, since the existing marked edges plus the entering edge is odd.

Now we can prove that if all vertices have even degree, we can find an Euler circuit. Pick a vertex and find the circuit as above. If not every edge is included, find a vertex v2 on the circuit so far that doesn't have all its edges used. Find a loop circuit starting at v2, using only edges not traversed so far, and splice that in to the circuit. Eventually every vertex on the circuit will have all edges used.

Could there still be a vertex not on the circuit? Not if the graph is connected. Why?

### Hamiltonian Paths and Circuits

How about a path which visits each vertex exactly once? Such a path is a Hamilton (or Hamiltonian) path.

There is no easy test for whether a graph has a Hamilton path.

### Finite-State Machines

Regular expression: * means repeat 0 or more times, ? means either 0 or 1 times

• b a* c
• b? a* c?
• 1 (01*0)* 1  (supposedly odd binary numbers divisible by 3)
• [a-z][a-z,0-9]* (for programming-language identifiers)
• [0-9]*(.[0-9]*)?(e[0-9]*)?  (for floating-point numbers, eg 12.345e67

What strings match these?

What does a finite-state recognizer for these look like?

How about b (aa)* a? There's a difference here.