Skip to content

Commit c7bcf05

Browse files
feat(Combinatorics/SimpleGraph/Connectivity): define vertex connectivity
1 parent 88c4804 commit c7bcf05

2 files changed

Lines changed: 136 additions & 0 deletions

File tree

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3259,6 +3259,7 @@ public import Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected
32593259
public import Mathlib.Combinatorics.SimpleGraph.Connectivity.EdgeConnectivity
32603260
public import Mathlib.Combinatorics.SimpleGraph.Connectivity.Represents
32613261
public import Mathlib.Combinatorics.SimpleGraph.Connectivity.Subgraph
3262+
public import Mathlib.Combinatorics.SimpleGraph.Connectivity.VertexConnectivity
32623263
public import Mathlib.Combinatorics.SimpleGraph.Connectivity.WalkCounting
32633264
public import Mathlib.Combinatorics.SimpleGraph.Connectivity.WalkDecomp
32643265
public import Mathlib.Combinatorics.SimpleGraph.Copy
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
/-
2+
Copyright (c) 2025 Youheng Luo. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Youheng Luo
5+
-/
6+
module
7+
public import Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected
8+
public import Mathlib.Data.Set.Card
9+
10+
/-!
11+
# Vertex Connectivity
12+
13+
This file defines k-vertex-connectivity for simple graphs.
14+
15+
## Main definitions
16+
17+
* `SimpleGraph.IsVertexReachable`: Two vertices are `k`-vertex-reachable if they remain reachable
18+
after removing strictly fewer than `k` other vertices.
19+
* `SimpleGraph.IsVertexConnected`: A graph is `k`-vertex-connected if its order is strictly
20+
greater than `k` and any two distinct vertices are `k`-vertex-reachable.
21+
-/
22+
23+
@[expose] public section
24+
25+
namespace SimpleGraph
26+
27+
variable {V : Type*} {G H : SimpleGraph V} {k l : ℕ∞} {u v : V}
28+
29+
/-- `G.deleteVerts s` is the graph where all vertices in `s` are isolated. -/
30+
def deleteVerts (G : SimpleGraph V) (s : Set V) : SimpleGraph V where
31+
Adj u v := u ∉ s ∧ v ∉ s ∧ G.Adj u v
32+
symm _ _ h := ⟨h.2.1, h.1, h.2.2.symm⟩
33+
34+
@[simp]
35+
lemma deleteVerts_empty : G.deleteVerts ∅ = G := by
36+
ext; simp [deleteVerts]
37+
38+
@[simp]
39+
lemma deleteVerts_subset_le (s : Set V) : G.deleteVerts s ≤ G :=
40+
fun _ _ h ↦ h.2.2
41+
42+
variable (G k u v) in
43+
/-- Two vertices are `k`-vertex-reachable if they remain reachable after removing
44+
strictly fewer than `k` other vertices. -/
45+
def IsVertexReachable : Prop :=
46+
∀ ⦃s : Set V⦄, s.encard < k → u ∉ s → v ∉ s → (G.deleteVerts s).Reachable u v
47+
48+
@[simp]
49+
lemma IsVertexReachable.refl (u : V) : G.IsVertexReachable k u u :=
50+
fun _ _ _ _ ↦ .refl _
51+
52+
@[symm]
53+
lemma IsVertexReachable.symm (h : G.IsVertexReachable k u v) : G.IsVertexReachable k v u :=
54+
fun _ hs hv hu ↦ (h hs hu hv).symm
55+
56+
@[gcongr]
57+
lemma IsVertexReachable.mono (hGH : G ≤ H) (h : G.IsVertexReachable k u v) :
58+
H.IsVertexReachable k u v :=
59+
fun _ hs hu hv ↦ (h hs hu hv).mono (by intro _ _ ⟨h1, h2, h3⟩; exact ⟨h1, h2, hGH h3⟩)
60+
61+
@[gcongr]
62+
lemma IsVertexReachable.anti (hkl : k ≤ l) (h : G.IsVertexReachable l u v) :
63+
G.IsVertexReachable k u v :=
64+
fun _ hs ↦ h (hs.trans_le hkl)
65+
66+
@[simp]
67+
protected lemma IsVertexReachable.zero : G.IsVertexReachable 0 u v :=
68+
fun _ hs ↦ absurd hs (not_lt_of_ge (zero_le _))
69+
70+
lemma IsVertexReachable.of_adj (h : G.Adj u v) (k : ℕ∞) : G.IsVertexReachable k u v :=
71+
fun _ _ hu hv ↦ (Adj.reachable ⟨hu, hv, h⟩)
72+
73+
/-- A vertex pair is reachable if it is `k`-vertex-reachable for `k ≠ 0`. -/
74+
lemma IsVertexReachable.reachable {hk : k ≠ 0} (h : G.IsVertexReachable k u v) :
75+
G.Reachable u v := by
76+
have := pos_iff_ne_zero.mpr hk
77+
specialize h (s := ∅) (by simpa) (by simp) (by simp)
78+
rwa [deleteVerts_empty] at h
79+
80+
variable (G k) in
81+
/-- A graph is `k`-vertex-connected if its order is strictly greater than `k`
82+
and any two distinct vertices are `k`-vertex-reachable. -/
83+
def IsVertexConnected [Fintype V] (k : ℕ) : Prop :=
84+
k < Fintype.card V ∧ ∀ u v : V, u ≠ v → G.IsVertexReachable k u v
85+
86+
@[simp]
87+
protected lemma IsVertexConnected.zero [Fintype V] : G.IsVertexConnected 0 ↔ Nonempty V := by
88+
simp [IsVertexConnected, Fintype.card_pos_iff]
89+
90+
/-- 1-vertex-connectivity is equivalent to being a connected graph with at least 2 vertices. -/
91+
@[simp]
92+
protected lemma IsVertexConnected.one [Fintype V] :
93+
G.IsVertexConnected 11 < Fintype.card V ∧ G.Connected := by
94+
classical
95+
constructor
96+
· rintro ⟨h_card, h_reach⟩
97+
refine ⟨h_card, ?_⟩
98+
rw [connected_iff_exists_forall_reachable]
99+
have := Fintype.card_pos_iff.1 (zero_lt_one.trans h_card)
100+
rcases this with ⟨x⟩
101+
refine ⟨x, fun y ↦ ?_⟩
102+
by_cases hxy : x = y
103+
· subst hxy; exact .refl _
104+
· specialize h_reach x y hxy
105+
simpa using h_reach (s := ∅) (by simp)
106+
· rintro ⟨h_card, h_conn⟩
107+
refine ⟨h_card, fun u v huv ↦ ?_⟩
108+
intro s hs hu hv
109+
have : s = ∅ := by
110+
rw [← Set.encard_eq_zero, ← ENat.lt_one_iff_eq_zero]
111+
exact_mod_cast hs
112+
subst this
113+
rw [deleteVerts_empty]
114+
exact h_conn.preconnected u v
115+
116+
/-- Vertex connectivity is monotonic in `k`. -/
117+
@[gcongr]
118+
lemma IsVertexConnected.anti [Fintype V] {k l : ℕ} (hkl : l ≤ k) (hc : G.IsVertexConnected k) :
119+
G.IsVertexConnected l :=
120+
⟨lt_of_le_of_lt hkl hc.1,
121+
fun u v huv ↦ IsVertexReachable.anti (Nat.cast_le.mpr hkl) (hc.2 u v huv)⟩
122+
123+
/-- Vertex connectivity is monotonic in the graph. -/
124+
@[gcongr]
125+
lemma IsVertexConnected.mono [Fintype V] {k : ℕ} (hGH : G ≤ H) (hc : G.IsVertexConnected k) :
126+
H.IsVertexConnected k :=
127+
⟨hc.1, fun u v huv ↦ IsVertexReachable.mono hGH (hc.2 u v huv)⟩
128+
129+
/-- The complete graph on `n` vertices is `(n-1)`-vertex-connected. -/
130+
lemma completeGraph_isVertexConnected [Fintype V] (h : 1 < Fintype.card V) :
131+
(⊤ : SimpleGraph V).IsVertexConnected (Fintype.card V - 1) :=
132+
⟨Nat.sub_lt (lt_trans Nat.zero_lt_one h) Nat.zero_lt_one,
133+
fun u v huv ↦ IsVertexReachable.of_adj (by simp [huv]) _⟩
134+
135+
end SimpleGraph

0 commit comments

Comments
 (0)