Domination, feedback vertex sets, and induced paths
Lax528502.GraphProblems · concepts/Lax528502/GraphProblems.lean · lax-528502
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
The objectives are minimum cardinality for domination and subset feedback vertex set, minimum total weight for weighted feedback vertex set, and maximum number of vertices for induced paths. An optimum is returned as a vertex set. Weights and the set of marked vertices are part of the input.
Concept map
Lean source view on GitHub
| 1 | import Mathlib.Combinatorics.SimpleGraph.Clique |
| 2 | import Mathlib.Combinatorics.SimpleGraph.Coloring.Vertex |
| 3 | import Mathlib.Combinatorics.SimpleGraph.Acyclic |
| 4 | |
| 5 | /-! |
| 6 | --- |
| 7 | title: Domination, feedback vertex sets, and induced paths |
| 8 | type: definition |
| 9 | --- |
| 10 | The objectives are minimum cardinality for domination and subset feedback |
| 11 | vertex set, minimum total weight for weighted feedback vertex set, and |
| 12 | maximum number of vertices for induced paths. An optimum is returned as a |
| 13 | vertex set. Weights and the set of marked vertices are part of the input. |
| 14 | -/ |
| 15 | |
| 16 | namespace Lax528502.GraphProblems |
| 17 | |
| 18 | /-- The optimization problems and their additional instance data. Weights are |
| 19 | nonnegative integers in binary. A subset feedback vertex set hits every cycle |
| 20 | that visits a marked vertex. -/ |
| 21 | inductive Problem (n : ℕ) |
| 22 | | dominating | totalDominating | independentDominating | connectedDominating |
| 23 | | weightedFeedback (weight : Fin n → ℕ) |
| 24 | | subsetFeedback (marked : Finset (Fin n)) |
| 25 | | longestInducedPath |
| 26 | |
| 27 | /-- Membership bits in vertex order. -/ |
| 28 | def incidence {n : ℕ} (S : Finset (Fin n)) : List ℕ := |
| 29 | List.ofFn fun i => if i ∈ S then 1 else 0 |
| 30 | |
| 31 | /-- Problem tag and data following the graph and its sequence. -/ |
| 32 | def Problem.words {n : ℕ} : Problem n → List ℕ |
| 33 | | .dominating => [0] |
| 34 | | .totalDominating => [1] |
| 35 | | .independentDominating => [2] |
| 36 | | .connectedDominating => [3] |
| 37 | | .weightedFeedback w => 4 :: List.ofFn w |
| 38 | | .subsetFeedback marked => 5 :: incidence marked |
| 39 | | .longestInducedPath => [6] |
| 40 | |
| 41 | def Dominates {n : ℕ} (G : SimpleGraph (Fin n)) (S : Finset (Fin n)) : Prop := |
| 42 | ∀ v, v ∈ S ∨ ∃ u ∈ S, G.Adj u v |
| 43 | |
| 44 | /-- The set can be ordered as a path with no chords. -/ |
| 45 | def InducesPath {n : ℕ} (G : SimpleGraph (Fin n)) (S : Finset (Fin n)) : Prop := |
| 46 | ∃ p : List (Fin n), p ≠ [] ∧ p.Nodup ∧ p.toFinset = S ∧ |
| 47 | ∀ i j : Fin p.length, G.Adj (p.get i) (p.get j) ↔ i.val + 1 = j.val ∨ j.val + 1 = i.val |
| 48 | |
| 49 | def Problem.Feasible {n : ℕ} (G : SimpleGraph (Fin n)) (S : Finset (Fin n)) : |
| 50 | Problem n → Prop |
| 51 | | .dominating => Dominates G S |
| 52 | | .totalDominating => ∀ v, ∃ u ∈ S, G.Adj u v |
| 53 | | .independentDominating => Dominates G S ∧ G.IsIndepSet (S : Set (Fin n)) |
| 54 | | .connectedDominating => Dominates G S ∧ (G.induce (S : Set (Fin n))).Connected |
| 55 | | .weightedFeedback _ => (G.induce {v | v ∉ S}).IsAcyclic |
| 56 | | .subsetFeedback marked => |
| 57 | ∀ v, ∀ p : G.Walk v v, p.IsCycle → (∃ u ∈ p.support, u ∈ marked) → |
| 58 | ∃ u ∈ p.support, u ∈ S |
| 59 | | .longestInducedPath => InducesPath G S |
| 60 | |
| 61 | /-- Compare two feasible vertex sets according to the selected objective. -/ |
| 62 | def Problem.AtLeastAsGood {n : ℕ} (S T : Finset (Fin n)) : Problem n → Prop |
| 63 | | .weightedFeedback w => S.sum w ≤ T.sum w |
| 64 | | .longestInducedPath => T.card ≤ S.card |
| 65 | | _ => S.card ≤ T.card |
| 66 | |
| 67 | /-- Output 0 if infeasible, or 1 and the membership vector of an optimum. -/ |
| 68 | def Problem.Answer {n : ℕ} (P : Problem n) (G : SimpleGraph (Fin n)) (out : List ℕ) : Prop := |
| 69 | (out = [0] ∧ ¬ ∃ S, P.Feasible G S) ∨ |
| 70 | ∃ S, out = 1 :: incidence S ∧ P.Feasible G S ∧ |
| 71 | ∀ T, P.Feasible G T → P.AtLeastAsGood S T |
| 72 | |
| 73 | /-- Frame a graph instance and its accompanying problem data. -/ |
| 74 | def input {n : ℕ} (x : List ℕ) (P : Problem n) : List ℕ := x.length :: x ++ P.words |
| 75 | |
| 76 | end Lax528502.GraphProblems |
| 77 |
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments