Counting walks of a given length #
Main definitions #
walkLengthTwoEquivCommonNeighbors: bijective correspondence between walks of length two fromutovand common neighbours ofuandv. Note thatuandvmay be the same.finsetWalkLength: theFinsetof length-nwalks fromutov. This is used to give{p : G.walk u v | p.length = n}aFintypeinstance, and it can also be useful as a recursive description of this set whenVis finite.
TODO: should this be extended further?
theorem
SimpleGraph.ConnectedComponent.card_le_card_of_le
{V : Type u}
[Finite V]
{G G' : SimpleGraph V}
(h : G ≤ G')
:
theorem
SimpleGraph.reachable_iff_exists_finsetWalkLength_nonempty
{V : Type u}
(G : SimpleGraph V)
[DecidableEq V]
[Fintype V]
[DecidableRel G.Adj]
(u v : V)
:
@[implicit_reducible]
instance
SimpleGraph.instDecidableRelReachable
{V : Type u}
(G : SimpleGraph V)
[DecidableEq V]
[Fintype V]
[DecidableRel G.Adj]
:
Equations
- G.instDecidableRelReachable u v = decidable_of_iff' (∃ (n : Fin (Fintype.card V)), (G.finsetWalkLength (↑n) u v).Nonempty) ⋯
@[implicit_reducible]
instance
SimpleGraph.instFintypeConnectedComponent
{V : Type u}
(G : SimpleGraph V)
[DecidableEq V]
[Fintype V]
[DecidableRel G.Adj]
:
Equations
@[implicit_reducible]
instance
SimpleGraph.instDecidablePreconnected
{V : Type u}
(G : SimpleGraph V)
[DecidableEq V]
[Fintype V]
[DecidableRel G.Adj]
:
Equations
- G.instDecidablePreconnected = inferInstanceAs (Decidable (∀ (u v : V), G.Reachable u v))
@[implicit_reducible]
instance
SimpleGraph.instDecidableConnected
{V : Type u}
(G : SimpleGraph V)
[DecidableEq V]
[Fintype V]
[DecidableRel G.Adj]
:
Equations
@[implicit_reducible]
instance
SimpleGraph.instDecidableMemSupp
{V : Type u}
(G : SimpleGraph V)
[DecidableEq V]
[Fintype V]
[DecidableRel G.Adj]
(c : G.ConnectedComponent)
(v : V)
:
Equations
- G.instDecidableMemSupp c v = SimpleGraph.ConnectedComponent.recOn c (fun (w : V) => decidable_of_iff (G.Reachable v w) ⋯) ⋯
theorem
SimpleGraph.disjiUnion_supp_toFinset_eq_supp_toFinset
{V : Type u}
{G : SimpleGraph V}
[DecidableEq V]
[Fintype V]
[DecidableRel G.Adj]
{G' : SimpleGraph V}
(h : G ≤ G')
(c' : G'.ConnectedComponent)
[Fintype ↑c'.supp]
[DecidablePred fun (c : G.ConnectedComponent) => c.supp ⊆ c'.supp]
:
{c : G.ConnectedComponent | c.supp ⊆ c'.supp}.disjiUnion (fun (c : G.ConnectedComponent) => c.supp.toFinset) ⋯ = c'.supp.toFinset
@[reducible, inline]
The odd components are the connected components of odd cardinality. This definition excludes infinite components.
Equations
- G.oddComponents = {c : G.ConnectedComponent | Odd c.supp.ncard}
Instances For
theorem
SimpleGraph.ConnectedComponent.odd_oddComponents_ncard_subset_supp
{V : Type u}
(G : SimpleGraph V)
[Finite V]
{G' : SimpleGraph V}
(h : G ≤ G')
(c' : G'.ConnectedComponent)
:
theorem
SimpleGraph.ncard_oddComponents_mono
{V : Type u}
(G : SimpleGraph V)
[Finite V]
{G' : SimpleGraph V}
(h : G ≤ G')
: