Documentation

Mathlib.Combinatorics.SimpleGraph.Finite

Definitions for finite and locally finite graphs #

This file defines finite versions of edgeSet, neighborSet and incidenceSet and proves some of their basic properties. It also defines the notion of a locally finite graph, which is one whose vertices have finite degree.

The design for finiteness is that each definition takes the smallest finiteness assumption necessary. For example, SimpleGraph.neighborFinset v only requires that v have finitely many neighbors.

Main definitions #

Naming conventions #

If the vertex type of a graph is finite, we refer to its cardinality as CardVerts or card_verts.

Implementation notes #

@[reducible]

The edgeSet of the graph as a Finset.

Equations
Instances For

    Alias of the reverse direction of SimpleGraph.edgeFinset_subset_edgeFinset.

    @[simp]
    theorem SimpleGraph.edgeSet_univ_card {V : Type u_1} {G : SimpleGraph V} [Fintype (SimpleGraph.edgeSet G)] :
    Finset.univ.card = (SimpleGraph.edgeFinset G).card
    @[simp]

    The complete graph on n vertices has n.choose 2 edges.

    Any graph on n vertices has at most n.choose 2 edges.

    def SimpleGraph.DeleteFar {V : Type u_1} (G : SimpleGraph V) {𝕜 : Type u_2} [OrderedRing 𝕜] [Fintype (Sym2 V)] [DecidableRel G.Adj] (p : SimpleGraph VProp) (r : 𝕜) :

    A graph is r-delete-far from a property p if we must delete at least r edges from it to get a graph with the property p.

    Equations
    Instances For
      theorem SimpleGraph.deleteFar_iff {V : Type u_1} {G : SimpleGraph V} {𝕜 : Type u_2} [OrderedRing 𝕜] [Fintype (Sym2 V)] [DecidableEq V] [DecidableRel G.Adj] {p : SimpleGraph VProp} {r : 𝕜} :
      SimpleGraph.DeleteFar G p r ∀ ⦃H : SimpleGraph V⦄ [inst : DecidableRel H.Adj], H Gp Hr (SimpleGraph.edgeFinset G).card - (SimpleGraph.edgeFinset H).card
      theorem SimpleGraph.DeleteFar.le_card_sub_card {V : Type u_1} {G : SimpleGraph V} {𝕜 : Type u_2} [OrderedRing 𝕜] [Fintype (Sym2 V)] [DecidableEq V] [DecidableRel G.Adj] {p : SimpleGraph VProp} {r : 𝕜} :
      SimpleGraph.DeleteFar G p r∀ ⦃H : SimpleGraph V⦄ [inst : DecidableRel H.Adj], H Gp Hr (SimpleGraph.edgeFinset G).card - (SimpleGraph.edgeFinset H).card

      Alias of the forward direction of SimpleGraph.deleteFar_iff.

      theorem SimpleGraph.DeleteFar.mono {V : Type u_1} {G : SimpleGraph V} {𝕜 : Type u_2} [OrderedRing 𝕜] [Fintype (Sym2 V)] [DecidableRel G.Adj] {p : SimpleGraph VProp} {r₁ : 𝕜} {r₂ : 𝕜} (h : SimpleGraph.DeleteFar G p r₂) (hr : r₁ r₂) :

      Finiteness at a vertex #

      This section contains definitions and lemmas concerning vertices that have finitely many adjacent vertices. We denote this condition by Fintype (G.neighborSet v).

      We define G.neighborFinset v to be the Finset version of G.neighborSet v. Use neighborFinset_eq_filter to rewrite this definition as a Finset.filter expression.

      G.neighbors v is the Finset version of G.Adj v in case G is locally finite at v.

      Equations
      Instances For
        @[simp]
        theorem SimpleGraph.mem_neighborFinset {V : Type u_1} (G : SimpleGraph V) (v : V) [Fintype (SimpleGraph.neighborSet G v)] (w : V) :
        def SimpleGraph.degree {V : Type u_1} (G : SimpleGraph V) (v : V) [Fintype (SimpleGraph.neighborSet G v)] :

        G.degree v is the number of vertices adjacent to v.

        Equations
        Instances For
          theorem SimpleGraph.degree_pos_iff_exists_adj {V : Type u_1} (G : SimpleGraph V) (v : V) [Fintype (SimpleGraph.neighborSet G v)] :
          0 < SimpleGraph.degree G v ∃ (w : V), G.Adj v w

          This is the Finset version of incidenceSet.

          Equations
          Instances For
            @[reducible]
            def SimpleGraph.LocallyFinite {V : Type u_1} (G : SimpleGraph V) :
            Type u_1

            A graph is locally finite if every vertex has a finite neighbor set.

            Equations
            Instances For

              A locally finite simple graph is regular of degree d if every vertex has degree d.

              Equations
              Instances For
                theorem SimpleGraph.neighborFinset_eq_filter {V : Type u_1} (G : SimpleGraph V) [Fintype V] {v : V} [DecidableRel G.Adj] :
                SimpleGraph.neighborFinset G v = Finset.filter (G.Adj v) Finset.univ
                def SimpleGraph.minDegree {V : Type u_1} (G : SimpleGraph V) [Fintype V] [DecidableRel G.Adj] :

                The minimum degree of all vertices (and 0 if there are no vertices). The key properties of this are given in exists_minimal_degree_vertex, minDegree_le_degree and le_minDegree_of_forall_le_degree.

                Equations
                Instances For

                  There exists a vertex of minimal degree. Note the assumption of being nonempty is necessary, as the lemma implies there exists a vertex.

                  The minimum degree in the graph is at most the degree of any particular vertex.

                  In a nonempty graph, if k is at most the degree of every vertex, it is at most the minimum degree. Note the assumption that the graph is nonempty is necessary as long as G.minDegree is defined to be a natural.

                  def SimpleGraph.maxDegree {V : Type u_1} (G : SimpleGraph V) [Fintype V] [DecidableRel G.Adj] :

                  The maximum degree of all vertices (and 0 if there are no vertices). The key properties of this are given in exists_maximal_degree_vertex, degree_le_maxDegree and maxDegree_le_of_forall_degree_le.

                  Equations
                  Instances For

                    There exists a vertex of maximal degree. Note the assumption of being nonempty is necessary, as the lemma implies there exists a vertex.

                    The maximum degree in the graph is at least the degree of any particular vertex.

                    In a graph, if k is at least the degree of every vertex, then it is at least the maximum degree.

                    The maximum degree of a nonempty graph is less than the number of vertices. Note that the assumption that V is nonempty is necessary, as otherwise this would assert the existence of a natural number less than zero.

                    theorem SimpleGraph.Adj.card_commonNeighbors_lt_degree {V : Type u_1} [Fintype V] {G : SimpleGraph V} [DecidableRel G.Adj] {v : V} {w : V} (h : G.Adj v w) :

                    If the condition G.Adj v w fails, then card_commonNeighbors_le_degree is the best we can do in general.