Documentation

Mathlib.Combinatorics.SimpleGraph.Acyclic

Acyclic graphs and trees #

This module introduces acyclic graphs (a.k.a. forests) and trees.

Main definitions #

Main statements #

References #

The structure of the proofs for SimpleGraph.IsAcyclic and SimpleGraph.IsTree, including supporting lemmas about SimpleGraph.IsBridge, generally follows the high-level description for these theorems for multigraphs from [Chou1994].

Tags #

acyclic graphs, trees

A graph is acyclic (or a forest) if it has no cycles.

Equations
    Instances For
      structure SimpleGraph.IsTree {V : Type u_1} (G : SimpleGraph V) :

      A tree is a connected acyclic graph.

      Instances For
        theorem SimpleGraph.IsAcyclic.comap {V : Type u_1} {V' : Type u_2} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G โ†’g G') (hinj : Function.Injective โ‡‘f) (h : G'.IsAcyclic) :

        A graph that has an injective homomorphism to an acyclic graph is acyclic.

        theorem SimpleGraph.IsAcyclic.embedding {V : Type u_1} {V' : Type u_2} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G โ†ชg G') (h : G'.IsAcyclic) :
        theorem SimpleGraph.Iso.isAcyclic_iff {V : Type u_1} {V' : Type u_2} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G โ‰ƒg G') :

        Isomorphic graphs are acyclic together.

        theorem SimpleGraph.Iso.isTree_iff {V : Type u_1} {V' : Type u_2} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G โ‰ƒg G') :

        Isomorphic graphs are trees together.

        theorem SimpleGraph.IsAcyclic.of_map {V : Type u_1} {V' : Type u_2} {G : SimpleGraph V} (f : V โ†ช V') (h : (SimpleGraph.map f G).IsAcyclic) :
        theorem SimpleGraph.IsAcyclic.of_comap {V : Type u_1} {V' : Type u_2} {G : SimpleGraph V} (f : V' โ†ช V) (h : G.IsAcyclic) :
        theorem SimpleGraph.IsAcyclic.induce {V : Type u_1} {G : SimpleGraph V} (h : G.IsAcyclic) (s : Set V) :

        A graph induced from an acyclic graph is acyclic.

        theorem SimpleGraph.IsAcyclic.subgraph {V : Type u_1} {G : SimpleGraph V} (h : G.IsAcyclic) (H : G.Subgraph) :

        A subgraph of an acyclic graph is acyclic.

        theorem SimpleGraph.IsAcyclic.anti {V : Type u_1} {G G' : SimpleGraph V} (hsub : G โ‰ค G') (h : G'.IsAcyclic) :

        A spanning subgraph of an acyclic graph is acyclic.

        theorem SimpleGraph.isAcyclic_sSup_of_isAcyclic_directedOn {V : Type u_1} (Hs : Set (SimpleGraph V)) (h_acyc : โˆ€ H โˆˆ Hs, H.IsAcyclic) (h_dir : DirectedOn (fun (x1 x2 : SimpleGraph V) => x1 โ‰ค x2) Hs) :

        The directed supremum of acyclic graphs is acylic.

        theorem SimpleGraph.exists_maximal_isAcyclic_of_le_isAcyclic {V : Type u_1} {G H : SimpleGraph V} (hHG : H โ‰ค G) (hH : H.IsAcyclic) :
        โˆƒ (H' : SimpleGraph V), H โ‰ค H' โˆง Maximal (fun (H : SimpleGraph V) => H โ‰ค G โˆง H.IsAcyclic) H'

        Every acyclic subgraph H โ‰ค G is contained in a maximal such subgraph.

        A connected component of an acyclic graph is a tree.

        theorem SimpleGraph.isAcyclic_iff_forall_adj_isBridge {V : Type u_1} {G : SimpleGraph V} :
        G.IsAcyclic โ†” โˆ€ โฆƒv w : Vโฆ„, G.Adj v w โ†’ G.IsBridge s(v, w)
        theorem SimpleGraph.isAcyclic_iff_forall_edge_isBridge {V : Type u_1} {G : SimpleGraph V} :
        G.IsAcyclic โ†” โˆ€ โฆƒe : Sym2 Vโฆ„, e โˆˆ G.edgeSet โ†’ G.IsBridge e
        theorem SimpleGraph.IsAcyclic.path_unique {V : Type u_1} {G : SimpleGraph V} (h : G.IsAcyclic) {v w : V} (p q : G.Path v w) :
        p = q
        theorem SimpleGraph.isAcyclic_of_path_unique {V : Type u_1} {G : SimpleGraph V} (h : โˆ€ (v w : V) (p q : G.Path v w), p = q) :
        theorem SimpleGraph.isAcyclic_iff_path_unique {V : Type u_1} {G : SimpleGraph V} :
        G.IsAcyclic โ†” โˆ€ โฆƒv w : Vโฆ„ (p q : G.Path v w), p = q
        theorem SimpleGraph.IsAcyclic.mem_support_of_ne_mem_support_of_adj_of_isPath {V : Type u_1} {G : SimpleGraph V} (hG : G.IsAcyclic) {u v w : V} {p : G.Walk u v} {q : G.Walk u w} (hp : p.IsPath) (hq : q.IsPath) (hadj : G.Adj v w) (hv : v โˆ‰ q.support) :
        theorem SimpleGraph.IsAcyclic.ne_mem_support_of_support_of_adj_of_isPath {V : Type u_1} {G : SimpleGraph V} (hG : G.IsAcyclic) {u v w : V} {p : G.Walk u v} {q : G.Walk u w} (hp : p.IsPath) (hq : q.IsPath) (hadj : G.Adj v w) (hw : w โˆˆ p.support) :
        v โˆ‰ q.support
        theorem SimpleGraph.IsAcyclic.path_concat {V : Type u_1} {G : SimpleGraph V} (hG : G.IsAcyclic) {u v w : V} {p : G.Walk u v} {q : G.Walk u w} (hp : p.IsPath) (hq : q.IsPath) (hadj : G.Adj v w) (hv : v โˆˆ q.support) :
        q = p.concat hadj
        theorem SimpleGraph.IsAcyclic.isPath_iff_isChain {V : Type u_1} {G : SimpleGraph V} (hG : G.IsAcyclic) {v w : V} (p : G.Walk v w) :
        p.IsPath โ†” List.IsChain (fun (x1 x2 : Sym2 V) => x1 โ‰  x2) p.edges

        A minimally connected graph is a tree.

        Adding an edge to an acyclic graph preserves acyclicity if the endpoints are not reachable.

        The reachability relation of a maximal acyclic subgraph agrees with that of the larger graph.

        A subgraph is maximal acyclic iff its reachability relation agrees with the larger graph.

        A subgraph of a connected graph is maximal acyclic iff it is a tree.

        Every acyclic subgraph can be extended to a spanning forest.

        Every graph has a spanning forest.

        theorem SimpleGraph.Connected.exists_isTree_le_of_le_of_isAcyclic {V : Type u_1} {G H : SimpleGraph V} (h : G.Connected) (hH_le : H โ‰ค G) (hH_isAcyclic : H.IsAcyclic) :

        Every acyclic subgraph of a connected graph can be extended to a spanning tree.

        theorem SimpleGraph.Connected.exists_isTree_le {V : Type u_1} {G : SimpleGraph V} (h : G.Connected) :
        โˆƒ T โ‰ค G, T.IsTree

        Every connected graph has a spanning tree.

        Every connected graph on n vertices has at least n-1 edges.

        The minimum degree of all vertices in a nontrivial tree is one.

        theorem SimpleGraph.IsTree.exists_vert_degree_one_of_nontrivial {V : Type u_1} {G : SimpleGraph V} [Fintype V] [Nontrivial V] [DecidableRel G.Adj] (h : G.IsTree) :
        โˆƒ (v : V), G.degree v = 1

        A nontrivial tree has a vertex of degree one.

        theorem SimpleGraph.Connected.induce_compl_singleton_of_degree_eq_one {V : Type u_1} {G : SimpleGraph V} (hconn : G.Connected) {v : V} [Fintype โ†‘(G.neighborSet v)] (hdeg : G.degree v = 1) :

        The graph resulting from removing a vertex of degree one from a connected graph is connected.

        A finite nontrivial connected graph contains a vertex that leaves the graph connected if removed.

        A finite connected graph contains a vertex that leaves the graph preconnected if removed.

        theorem SimpleGraph.IsAcyclic.dist_ne_of_adj {V : Type u_1} {G : SimpleGraph V} (hG : G.IsAcyclic) {u v w : V} (hadj : G.Adj v w) (hreach : G.Reachable u v) :
        G.dist u v โ‰  G.dist u w
        theorem SimpleGraph.IsTree.dist_ne_of_adj {V : Type u_1} {G : SimpleGraph V} (hG : G.IsTree) (u : V) {v w : V} (hadj : G.Adj v w) :
        G.dist u v โ‰  G.dist u w
        theorem SimpleGraph.IsAcyclic.dist_eq_dist_add_one_of_adj_of_reachable {V : Type u_1} {G : SimpleGraph V} (hG : G.IsAcyclic) (u : V) {v w : V} (hadj : G.Adj v w) (hreach : G.Reachable u v) :
        G.dist u v = G.dist u w + 1 โˆจ G.dist u w = G.dist u v + 1
        theorem SimpleGraph.IsTree.dist_eq_dist_add_one_of_adj {V : Type u_1} {G : SimpleGraph V} (hG : G.IsTree) (u : V) {v w : V} (hadj : G.Adj v w) :
        G.dist u v = G.dist u w + 1 โˆจ G.dist u w = G.dist u v + 1
        noncomputable def SimpleGraph.IsTree.coloringTwoOfVert {V : Type u_1} {G : SimpleGraph V} (hG : G.IsTree) (u : V) :

        The unique two-coloring of a tree that colors the given vertex with zero

        Equations
          Instances For
            noncomputable def SimpleGraph.IsTree.coloringTwo {V : Type u_1} {G : SimpleGraph V} (hG : G.IsTree) :

            Arbitrary coloring with two colors for a tree

            Equations
              Instances For
                noncomputable def SimpleGraph.IsAcyclic.coloringTwoOfVerts {V : Type u_1} {G : SimpleGraph V} (hG : G.IsAcyclic) (verts : G.ConnectedComponent โ†’ V) (h : โˆ€ (C : G.ConnectedComponent), verts C โˆˆ C) :

                The unique two-coloring of a forest that colors the given vertices with zero

                Equations
                  Instances For
                    noncomputable def SimpleGraph.IsAcyclic.coloringTwo {V : Type u_1} {G : SimpleGraph V} (hG : G.IsAcyclic) :

                    Arbitrary coloring with two colors for a forest

                    Equations
                      Instances For