Slide 1

Slide 1 text

A crash course on graph theory Tasuku Soma (ISM) iTHEMS Graph-Theory meeting 2023 1 / 56

Slide 2

Slide 2 text

What is this course about? This course provides a very brief introduction to graph theory. Topics • Basic terminology • Connectivity • Planar graphs • Matchings Topics NOT covered: graph coloring, extremal graph theory, spectral graph theory, random graphs, graph limits, and many others... 2 / 56

Slide 3

Slide 3 text

What is this course intended for? Rather than giving formal definition and proofs, this course is intended for getting intuition with many examples and visualizations. More formal exposition can be found in great textbooks, e.g., • Diestel “Graph Theory” • Schrijver “Combinatorial Optimization: Polyhedra and Efficiency” 3 / 56

Slide 4

Slide 4 text

1 What is a graph? 2 Connectivity 3 Planar graphs 4 Matchings 4 / 56

Slide 5

Slide 5 text

1 What is a graph? 2 Connectivity 3 Planar graphs 4 Matchings 5 / 56

Slide 6

Slide 6 text

What is a graph? vertex edge A graph is a pair of vertices and edges, usually written as G = ( V vertex set , E edge set ) In this talk, we only consider finite graphs, i.e., |V |, |E| < +∞. 6 / 56

Slide 7

Slide 7 text

Loops, parellel edges, simple graphs Loop Parallel edges Graphs without loops and parallel edges are called simple graphs. Simple Not simple In this talk, we only consider simple graphs. 7 / 56

Slide 8

Slide 8 text

Directed graphs (digraphs) A directed graph or digraph is a graph where edges have directions (directed edges or arcs). tail head 8 / 56

Slide 9

Slide 9 text

Example: Railway network Vertex=station, Edge=railway Taken from: https://www.tokyometro.jp/library_in/en/subwaymap/pdf/rosen_en_1803.pdf 9 / 56

Slide 10

Slide 10 text

Example: Chemical reaction networks Vertex=chemicals, Edge=reactions Taken from: Mochizuki, A. A structural approach to understanding enzymatic regulation of chemical reaction networks. Biochem J 17 479 (11), 1265–1283, (2022). 10 / 56

Slide 11

Slide 11 text

Example: Phylogenetic network Vertex=gene, Edge= mutated-from-to relation Taken from: Hussain, I., Pervaiz, N., Khan, A. et al. Evolutionary and structural analysis of SARS-CoV-2 specific evasion of host immunity. Genes Immun 21, 409–41911 / 56

Slide 12

Slide 12 text

Subgraphs, induced subgraphs • Graph H is called a subgraph of G if H is contained in G. • H is an induced subgraph of G if V (H) = X and E(H) = {ij ∈ E(G) | i, j ∈ X} for some X ⊆ V (G). subgraph induced subgraph 12 / 56

Slide 13

Slide 13 text

Degree G = (V, E): undirected graph The degree of a vertex v is the number of edges incident to v. Denoted by d(v). 4 3 3 3 2 1 0 13 / 56

Slide 14

Slide 14 text

Degree G = (V, E): undirected graph The degree of a vertex v is the number of edges incident to v. Denoted by d(v). 4 3 3 3 2 1 0 Theorem (“First theorem of graph theory”) v∈V d(v) = 2|E| 13 / 56

Slide 15

Slide 15 text

Theorem (“First theorem of graph theory”) v∈V d(v) = 2|E|

Slide 16

Slide 16 text

Theorem (“First theorem of graph theory”) v∈V d(v) = 2|E| 14 / 56

Slide 17

Slide 17 text

Complete graphs, bipartete graphs G = (V, E): undirected graph • G is complete if ij ∈ E for all distinct i, j ∈ V . complete graph • G is bipartite if V can be partitioned into two sets V1 , V2 s.t. ij ∈ E implies i ∈ V1 and j ∈ V2 . • tripartite and k-partite graphs are defined similarly. V1 V2 bipartite graph 15 / 56

Slide 18

Slide 18 text

Paths and cycles • Walk is a sequence of vertices (v0 , v1 , . . . , vk ) s.t. vi−1 vi ∈ E (i = 1, . . . , k). k is the length of the walk. • Walk is closed if with v0 = vk . • Path is a walk with distinct vertices. • Cycle is a path of length ≥ 2 plus an edge between the two endpoints of the path. Walk Path Closed walk Cycle 16 / 56

Slide 19

Slide 19 text

Connected graphs and components • An undirected graph is connected if there is a path between any two distinct vertices. • Each maximal connected subgraph is called a connected component. connected disconnected 17 / 56

Slide 20

Slide 20 text

Forests and Trees • A undirected graph is a forest if it has no cycles. • A connected forest is called a tree. • A tree has vertices with degree 1 (leaves) • A tree is binary if non-leaf vertices have exactly two children. tree leaves forest binary tree 18 / 56

Slide 21

Slide 21 text

Shortest paths, diameter Unweighted graph • An s–t path is a path from a vertex s to a vertex t. • dist(s, t) = length of a shortest s–t path • Diameter is diam(G) := maxs,t∈V dist(s, t) s t dist(s, t) = 3 = diam(G) 19 / 56

Slide 22

Slide 22 text

Shortest paths, diameter Unweighted graph • An s–t path is a path from a vertex s to a vertex t. • dist(s, t) = length of a shortest s–t path • Diameter is diam(G) := maxs,t∈V dist(s, t) s t dist(s, t) = 3 = diam(G) Weighted graph • Each edge e ∈ E has a weight (length) w(e) ∈ R. • Then, the length of a path is the sum of edge lengths. s 3 2 1 2 −3 1 t 1 dist(s, t) = 1 19 / 56

Slide 23

Slide 23 text

Shortest path problem Shortest path problem Given: connected graph G = (V, E), edge weight w(e) ∈ R (e ∈ E), s, t ∈ V Find: shortest s–t path (if exists) Theorem For the shortest path problem, there are • O(n3)-time algorithm (Bellman-Ford) for general weight • O(m + n log n)-time algorithm (Dikstra) for nonnegative weight where n = |V | and m = |E|. 20 / 56

Slide 24

Slide 24 text

Common graph families Complete graph (Clique) Kn Complete bipartite graph Kmn Cycle graph Cn Path graph Pn Star graph Sn 21 / 56

Slide 25

Slide 25 text

Graph softwares There are many (free) graph softwares. I personally find NetworkX handy. • Python based (so you can try on e.g. Google’s Colab) • Easy to use and well-documented • Many graph families and algorithms implemented • Integrated with SageMath NetworkX Network Analysis in Python 22 / 56

Slide 26

Slide 26 text

1 What is a graph? 2 Connectivity 3 Planar graphs 4 Matchings 23 / 56

Slide 27

Slide 27 text

Connectivity I’ll talk about two basic topics in connectivity: 1 Minimum spanning tree 2 Higher connectivity and Menger’s theorem 24 / 56

Slide 28

Slide 28 text

Minumim spanning tree (MST) G = (V, E): undirected, connected graph • A subgraph H of G is spanning if V (G) = V (H). • A spanning tree is a tree in G that is spanning. A spanning tree 25 / 56

Slide 29

Slide 29 text

Minumim spanning tree (MST) G = (V, E): undirected, connected graph • A subgraph H of G is spanning if V (G) = V (H). • A spanning tree is a tree in G that is spanning. Minimum spanning tree problem Given: connected graph G = (V, E), edge weight w(e) ∈ R (e ∈ E) Find: spanning tree T of G s.t. e∈T w(e) is minimized. A spanning tree 25 / 56

Slide 30

Slide 30 text

4 8 7 9 10 2 1 8 11 7 2 6 4 14 26 / 56

Slide 31

Slide 31 text

Kruskal algorithm for MST Kruskal algorithm 1: Let T be the empty forest on V 2: Sort edges in increasing order of weight: w(e1 ) ≤ · · · ≤ w(em ) (m = |E|). 3: for i = 1, . . . , m : 4: Add ei to T if it does not create a cycle. Otherwise, discard ei . 5: return T 27 / 56

Slide 32

Slide 32 text

Kruskal algorithm for MST Kruskal algorithm 1: Let T be the empty forest on V 2: Sort edges in increasing order of weight: w(e1 ) ≤ · · · ≤ w(em ) (m = |E|). 3: for i = 1, . . . , m : 4: Add ei to T if it does not create a cycle. Otherwise, discard ei . 5: return T Remark: Kruskal’s algorithm can be generalized to the greedy algorithm for mimumum weight base in matroids. Theorem Kruskal algorithm outputs a MST in O(m log m) time, where m = |E|. 27 / 56

Slide 33

Slide 33 text

4 8 7 9 10 2 1 8 11 7 2 6 4 14 28 / 56

Slide 34

Slide 34 text

4 8 7 9 10 2 1 8 11 7 2 6 4 14 28 / 56

Slide 35

Slide 35 text

4 8 7 9 10 2 1 8 11 7 2 6 4 14 28 / 56

Slide 36

Slide 36 text

4 8 7 9 10 2 1 8 11 7 2 6 4 14 28 / 56

Slide 37

Slide 37 text

4 8 7 9 10 2 1 8 11 7 2 6 4 14 28 / 56

Slide 38

Slide 38 text

4 8 7 9 10 2 1 8 11 7 2 6 4 14 28 / 56

Slide 39

Slide 39 text

4 8 7 9 10 2 1 8 11 7 2 6 4 14 28 / 56

Slide 40

Slide 40 text

4 8 7 9 10 2 1 8 11 7 2 6 4 14 28 / 56

Slide 41

Slide 41 text

Connectivity I’ll talk about two basic topics in connectivity: 1 Minimum spanning tree 2 Higher connectivity and Menger’s theorem 29 / 56

Slide 42

Slide 42 text

4 8 7 9 10 2 1 8 11 7 2 6 4 14 30 / 56

Slide 43

Slide 43 text

4 8 7 9 10 2 1 8 11 7 2 6 4 14 30 / 56

Slide 44

Slide 44 text

k-vertex-connectivity Definition An undirected graph (with more than k vertices) is k-vertex-connected if it remains connected after removing any vertex subset X ⊆ V with |X| ≤ k − 1. 1-vertex connected but NOT 2-vertex connected 2-vertex connected but NOT 3-vertex connected 31 / 56

Slide 45

Slide 45 text

k-edge-connectivity Definition An (nonempty) undirected graph is k-edge-connected if it remains connected after removing any edge subset F ⊆ E with |F| ≤ k − 1. 1-edge connected but NOT 2-edge connected 2-edge connected but NOT 3-edge connected 32 / 56

Slide 46

Slide 46 text

Disjoint paths problem Vertex disjoint s–t paths problem Given: Connected graph G = (V, E), s, t ∈ V Find: Maximum set of vertex-disjoint s–t paths. s t vertex-disjoint s–t paths 33 / 56

Slide 47

Slide 47 text

Disjoint paths problem Vertex disjoint s–t paths problem Given: Connected graph G = (V, E), s, t ∈ V Find: Maximum set of vertex-disjoint s–t paths. s t vertex-disjoint s–t paths Edge disjoint s–t paths problem Given: Connected graph G = (V, E), s, t ∈ V Find: Maximum set of edge-disjoint s–t paths. s t edge-disjoint s–t paths 33 / 56

Slide 48

Slide 48 text

Cuts • For a vertex subset X ⊆ V , let the cut of X be E[X, ¯ X] = {uv ∈ E : u ∈ X, v ̸∈ X}. • For s, t ∈ V , an s–t cut is a cut for X s.t. s ∈ X and t / ∈ X. X E[X, ¯ X] 34 / 56

Slide 49

Slide 49 text

Cuts • For a vertex subset X ⊆ V , let the cut of X be E[X, ¯ X] = {uv ∈ E : u ∈ X, v ̸∈ X}. • For s, t ∈ V , an s–t cut is a cut for X s.t. s ∈ X and t / ∈ X. X E[X, ¯ X] Observation Maximum number of s–t paths ≤ minimum size of s–t cut. It’s actually tight! (Menger’s theorem) 34 / 56

Slide 50

Slide 50 text

Menger’s theorem Theorem (Menger’s theorem (edge version)) Maximum number of edge-disjoint s–t paths = Minimum size of s–t cut. min s–t cut (size = 2) s t 35 / 56

Slide 51

Slide 51 text

Menger’s theorem Theorem (Menger’s theorem (edge version)) Maximum number of edge-disjoint s–t paths = Minimum size of s–t cut. min s–t cut (size = 2) s t Connection to edge-connectivity Corollary G is k-edge-connected ⇐⇒ |E[X, ¯ X]| ≥ k for ∅ ̸= ∀X ⊊ V ⇐⇒ G has at least k edge-disjoint s–t paths for any distinct s, t ∈ V 35 / 56

Slide 52

Slide 52 text

Menger’s theorem Theorem (Menger’s theorem (vertex version)) Maximum number of vertex-disjoint s–t paths = min{|U| : U ⊆ V seperating s and t}. Max s–t paths ≤ min |U| is trivial. Menger’s theorem says it’s actually tight! min s–t separating set (size = 2) s t Connection to vertex-connectivity Corollary G is k-vertex-connected ⇐⇒ G has at least k vertex-disjoint s–t paths for any distinct s, t ∈ V 36 / 56

Slide 53

Slide 53 text

1 What is a graph? 2 Connectivity 3 Planar graphs 4 Matchings 37 / 56

Slide 54

Slide 54 text

Planar graphs G = (V, E): undirected graph • G is planar if G can be drawn on R2 without edge crossings. • Such a drawing is called a planar embedding or a plane graph. planar graph (K4 ) planar embedding 38 / 56

Slide 55

Slide 55 text

Quiz Find planar embeddings of the following planar graphs: 39 / 56

Slide 56

Slide 56 text

Quiz Find planar embeddings of the following planar graphs: 39 / 56

Slide 57

Slide 57 text

Applications of planar graph road network Delaunay triangulation Left: https://www.mlit.go.jp/road/road_e/p1_highway.html Right: https://commons.wikimedia.org/wiki/File:Delaunay_Triangulation_(100_Points).svg 40 / 56

Slide 58

Slide 58 text

Faces and outer face

Slide 59

Slide 59 text

Faces and outer face outer face face 41 / 56

Slide 60

Slide 60 text

Euler’s formula Theorem (Euler’s formula) Let G be a connected planar graph with n vertices, m edges, and f faces. Then n − m + f = 2. n = 8, m = 12, f = 6 42 / 56

Slide 61

Slide 61 text

Euler’s formula Theorem (Euler’s formula) Let G be a connected planar graph with n vertices, m edges, and f faces. Then n − m + f = 2. n = 8, m = 12, f = 6 Corollary A planar graph with n ≥ 3 vertices has at most 3n − 6 edges. A bipartite planar graph with n ≥ 3 vertices has at most 2n − 4 edges. 42 / 56

Slide 62

Slide 62 text

Non-planar graphs K5 K3,3 n = 5 n = 6 m = 10 > 3n − 6 m = 9 > 2n − 4 43 / 56

Slide 63

Slide 63 text

Non-planar graphs K5 K3,3 n = 5 n = 6 m = 10 > 3n − 6 m = 9 > 2n − 4 They are minimial non-planar graphs, i.e., removing any edge makes them planar. 43 / 56

Slide 64

Slide 64 text

Non-planar graphs K5 K3,3 n = 5 n = 6 m = 10 > 3n − 6 m = 9 > 2n − 4 They are minimial non-planar graphs, i.e., removing any edge makes them planar. Observation If G contains K5 or K3,3 as a subgraph, then G is not planar. Indeed, they characterize planarity! (Kuratowski’s theorem) 43 / 56

Slide 65

Slide 65 text

Kuratowski’s theorem Theorem (Kuratowski) A graph G is planar ⇐⇒ G contains neither a subdivision of K5 nor K3,3 as a subgraph. K5 a subdivision of K5 44 / 56

Slide 66

Slide 66 text

Contraction, deletion • Edge Contraction: “shrink” an edge into a single vertex (and removes loops and parallel edges). • Edge Deletion: “delete” an edge (but keeps its end vertices). • H is a minor of G if H can be obtained from G by a sequence of edge contractions and edge deletions. ↓ ↓ 45 / 56

Slide 67

Slide 67 text

Wagner’s theorem Minor operations preserve planarity. They also characterize planarity! Theorem (Wagner) A graph G is planar ⇐⇒ G contains neither K5 nor K3,3 as a minor. K5 and K3,3 are called the forbidden minors for planar graphs. 46 / 56

Slide 68

Slide 68 text

Graph minor theory Various graph families are minor-closed: Planar Outer planar Toroidal Taken from: https://commons.wikimedia.org/wiki/File:Toroidal_graph_sample.gif Theorem (Robertson and Seymour) Any minor-closed graph family can be characterized by a finite number of forbidden minors. • Planar: K5 , K3,3 • Outer planar: K4 , K2,3 • Toroidal: unknown (at least 17,523 graphs) 47 / 56

Slide 69

Slide 69 text

1 What is a graph? 2 Connectivity 3 Planar graphs 4 Matchings 48 / 56

Slide 70

Slide 70 text

Matchings G = (V, E): undirected graph • M ⊆ E is called a matching if any two edges in M do not share a vertex. • A matching M is perfect if 2|M| = |V |, i.e., M covers all vertices. • A matching M is maximum if |M| ≥ |M′| for any matching M′. A perfect matching 49 / 56

Slide 71

Slide 71 text

Maximum matching problem Maximum matching problem Given: connected graph G = (V, E) Find: maximum matching M of G. Given a matching, how do you check if it is maximum or not? 50 / 56

Slide 72

Slide 72 text

Augmenting paths M: matching in G Definition A path P in G is called an augmenting path if 1 edges in P alternate between M and E \ M; and 2 P starts and ends with vertices exposed by M. ∈ M / ∈ M |M| = 3 51 / 56

Slide 73

Slide 73 text

Augmenting paths M: matching in G Definition A path P in G is called an augmenting path if 1 edges in P alternate between M and E \ M; and 2 P starts and ends with vertices exposed by M. ∈ M / ∈ M |M| = 3 ↓ flip |M| = 4 51 / 56

Slide 74

Slide 74 text

Augmenting paths M: matching in G Definition A path P in G is called an augmenting path if 1 edges in P alternate between M and E \ M; and 2 P starts and ends with vertices exposed by M. ∈ M / ∈ M |M| = 3 ↓ flip |M| = 4 So, M is maximum =⇒ there is no augmenting path. 51 / 56

Slide 75

Slide 75 text

Augmenting paths M is not maximum =⇒ there is an augmenting path. 52 / 56

Slide 76

Slide 76 text

Augmenting paths M is not maximum =⇒ there is an augmenting path. Take arbitrary matchings M, M′ s.t. |M| < |M′|. Then, the connected components of M + M′ consist of alternating paths and even cycles. Since |M| < |M′|, there must be an alternating path in M + M′ that starts and ends with vertices exposed by M. 52 / 56

Slide 77

Slide 77 text

König–Egerváry theorem Let’s consider bipartite G = (V1 , V2 ; E). 53 / 56

Slide 78

Slide 78 text

König–Egerváry theorem Let’s consider bipartite G = (V1 , V2 ; E). Definition A vertex subset (S1 , S2 ) is called a vertex cover if i ∈ S1 or j ∈ S2 for each edge ij ∈ E. S1 S2 53 / 56

Slide 79

Slide 79 text

König–Egerváry theorem Let’s consider bipartite G = (V1 , V2 ; E). Definition A vertex subset (S1 , S2 ) is called a vertex cover if i ∈ S1 or j ∈ S2 for each edge ij ∈ E. Obviously, max M: matching |M| ≤ min (S1 , S2 ): vertex cover |S1 | + |S2 |. S1 S2 53 / 56

Slide 80

Slide 80 text

König–Egerváry theorem Let’s consider bipartite G = (V1 , V2 ; E). Definition A vertex subset (S1 , S2 ) is called a vertex cover if i ∈ S1 or j ∈ S2 for each edge ij ∈ E. Obviously, max M: matching |M| ≤ min (S1 , S2 ): vertex cover |S1 | + |S2 |. Theorem (König–Egerváry) max M: matching |M| = min (S1 , S2 ): vertex cover |S1 | + |S2 |. S1 S2 53 / 56

Slide 81

Slide 81 text

Proof of König–Egerváry theorem 54 / 56

Slide 82

Slide 82 text

Proof of König–Egerváry theorem s t 54 / 56

Slide 83

Slide 83 text

Proof of König–Egerváry theorem s t 54 / 56

Slide 84

Slide 84 text

Proof of König–Egerváry theorem s t matching ←→ vertex disjoint s–t paths 54 / 56

Slide 85

Slide 85 text

Proof of König–Egerváry theorem s t matching ←→ vertex disjoint s–t paths Menger thm: max vertex disjoint s–t paths = min s–t separating set vertex cover ←→ s–t separating set 54 / 56

Slide 86

Slide 86 text

Tutte–Berge formula For non-bipartite graphs, König–Egerváry theorem may fail... Example: C3 has maximum matchings of size 1 but minimum vertex covers are of size 2. 55 / 56

Slide 87

Slide 87 text

Tutte–Berge formula For non-bipartite graphs, König–Egerváry theorem may fail... Example: C3 has maximum matchings of size 1 but minimum vertex covers are of size 2. Theorem (Tutte–Berge formula) max M: matching |M| = 1 2 min U⊆V (|U| − odd(G \ U) + |V |), where odd(G \ U) is the number of the connected components with odd vertices in G \ U. 55 / 56

Slide 88

Slide 88 text

Summary We have seen: • Basic terminology • Connectivity • Planar graphs • Matchings Further reading: • Diestel “Graph Theory” • Schrijver “Combinatorial Optimization: Polyhedra and Efficiency” 56 / 56

Slide 89

Slide 89 text

Summary We have seen: • Basic terminology • Connectivity • Planar graphs • Matchings Further reading: • Diestel “Graph Theory” • Schrijver “Combinatorial Optimization: Polyhedra and Efficiency” Thank you! Questions? 56 / 56