Maximum cuts
Lax222097.MaxCut · concepts/Lax222097/MaxCut.lean · lax-222097
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
For a graph on an ordered vertex set, each edge is represented once, by its endpoints . A cut is specified by a subset of vertices; its size is the number of edges with exactly one endpoint in . is the largest such size, with value zero for an edgeless graph.
Concept map
In the paper
- page 3 of this submission's paper
Lean source view on GitHub
| 1 | import Lax222097.GraphEncoding |
| 2 | |
| 3 | /-! |
| 4 | --- |
| 5 | title: Maximum cuts |
| 6 | type: definition |
| 7 | --- |
| 8 | For a graph on an ordered vertex set, each edge is represented once, by |
| 9 | its endpoints . A cut is specified by a subset of vertices; its size |
| 10 | is the number of edges with exactly one endpoint in . |
| 11 | is the largest such size, with value zero for an |
| 12 | edgeless graph. |
| 13 | -/ |
| 14 | |
| 15 | namespace Lax222097.MaxCut |
| 16 | |
| 17 | open scoped Classical |
| 18 | |
| 19 | open Finset |
| 20 | |
| 21 | /-- All edges, each listed once with its smaller endpoint first. -/ |
| 22 | noncomputable def edges {n : ℕ} (F : SimpleGraph (Fin n)) : |
| 23 | Finset (Fin n × Fin n) := |
| 24 | univ.filter fun e => e.1 < e.2 ∧ F.Adj e.1 e.2 |
| 25 | |
| 26 | /-- The number of edges crossing between `S` and its complement. -/ |
| 27 | noncomputable def cutSize {n : ℕ} (F : SimpleGraph (Fin n)) |
| 28 | (S : Finset (Fin n)) : ℕ := |
| 29 | ((edges F).filter fun e => |
| 30 | (e.1 ∈ S ∧ e.2 ∉ S) ∨ (e.1 ∉ S ∧ e.2 ∈ S)).card |
| 31 | |
| 32 | /-- The largest cut size over all subsets of vertices. -/ |
| 33 | noncomputable def maxCut {n : ℕ} (F : SimpleGraph (Fin n)) : ℕ := |
| 34 | (univ : Finset (Fin n)).powerset.sup (cutSize F) |
| 35 | |
| 36 | end Lax222097.MaxCut |
| 37 |
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments