definition
No public endorsements yet.
Loading review…
Sign in with ORCIDConcept map
Definition
For a finite simple graph, the edge count between two vertex sets counts the ordered cross-pairs which are adjacent in the graph. When the two sets are disjoint, this counts each edge between them exactly once, in the direction from to .
The edge density of and is this edge count divided by , as a real number. If one side is empty, the density is defined to be zero; regular pairs themselves require nonempty sides.
Lean source view on GitHub
| 1 | import Mathlib.Combinatorics.SimpleGraph.Basic |
| 2 | import Mathlib.Data.Real.Basic |
| 3 | |
| 4 | /-! |
| 5 | --- |
| 6 | title: Edge density between two vertex sets |
| 7 | type: definition |
| 8 | --- |
| 9 | For a finite simple graph, the edge count between two vertex sets counts the |
| 10 | ordered cross-pairs \((a,b)\in A\times B\) which are adjacent in the graph. |
| 11 | When the two sets are disjoint, this counts each edge between them exactly |
| 12 | once, in the direction from \(A\) to \(B\). |
| 13 | |
| 14 | The edge density of \(A\) and \(B\) is this edge count divided by |
| 15 | \(|A||B|\), as a real number. If one side is empty, the density is defined to |
| 16 | be zero; regular pairs themselves require nonempty sides. |
| 17 | -/ |
| 18 | |
| 19 | namespace Lax18.EdgeDensity |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | variable {V : Type u} [Fintype V] [DecidableEq V] |
| 24 | |
| 25 | /-- The number of adjacent ordered pairs from `A` to `B`. -/ |
| 26 | noncomputable def edgeCountBetween (G : SimpleGraph V) |
| 27 | (A B : Finset V) : ℕ := by |
| 28 | classical |
| 29 | exact ((A.product B).filter fun p : V × V => G.Adj p.1 p.2).card |
| 30 | |
| 31 | /-- The real-valued edge density between two vertex sets. -/ |
| 32 | noncomputable def density (G : SimpleGraph V) (A B : Finset V) : ℝ := |
| 33 | if A.card = 0 ∨ B.card = 0 then |
| 34 | 0 |
| 35 | else |
| 36 | (edgeCountBetween G A B : ℝ) / ((A.card : ℝ) * (B.card : ℝ)) |
| 37 | |
| 38 | end Lax18.EdgeDensity |
| 39 |
Builds on
none
Used by
Community review
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above; your ORCID profile must share a public name.
0 comments