Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A crash course on graph theory

Tasuku Soma
November 14, 2023

A crash course on graph theory

iTHEMS Graph-Theory meeting 2023

Tasuku Soma

November 14, 2023
Tweet

More Decks by Tasuku Soma

Other Decks in Education

Transcript

  1. 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
  2. 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
  3. 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
  4. 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
  5. Directed graphs (digraphs) A directed graph or digraph is a

    graph where edges have directions (directed edges or arcs). tail head 8 / 56
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. Common graph families Complete graph (Clique) Kn Complete bipartite graph

    Kmn Cycle graph Cn Path graph Pn Star graph Sn 21 / 56
  19. 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
  20. Connectivity I’ll talk about two basic topics in connectivity: 1

    Minimum spanning tree 2 Higher connectivity and Menger’s theorem 24 / 56
  21. 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
  22. 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
  23. 4 8 7 9 10 2 1 8 11 7

    2 6 4 14 26 / 56
  24. 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
  25. 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
  26. 4 8 7 9 10 2 1 8 11 7

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

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

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

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

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

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

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

    2 6 4 14 28 / 56
  34. Connectivity I’ll talk about two basic topics in connectivity: 1

    Minimum spanning tree 2 Higher connectivity and Menger’s theorem 29 / 56
  35. 4 8 7 9 10 2 1 8 11 7

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

    2 6 4 14 30 / 56
  37. 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
  38. 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
  39. 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
  40. 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
  41. 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
  42. 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
  43. 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
  44. 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
  45. 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
  46. 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
  47. 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
  48. 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
  49. 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
  50. Non-planar graphs K5 K3,3 n = 5 n = 6

    m = 10 > 3n − 6 m = 9 > 2n − 4 43 / 56
  51. 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
  52. 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
  53. 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
  54. 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
  55. 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
  56. 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
  57. 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
  58. 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
  59. 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
  60. 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
  61. 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
  62. 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
  63. 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
  64. 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
  65. 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
  66. 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
  67. 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
  68. 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
  69. Summary We have seen: • Basic terminology • Connectivity •

    Planar graphs • Matchings Further reading: • Diestel “Graph Theory” • Schrijver “Combinatorial Optimization: Polyhedra and Efficiency” 56 / 56
  70. 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