Documentation

Mathlib.Combinatorics.SimpleGraph.Operations

Local graph operations #

This file defines some single-graph operations that modify a finite number of vertices and proves basic theorems about them. When the graph itself has a finite number of vertices we also prove theorems about the number of edges in the modified graphs.

Main definitions #

def SimpleGraph.replaceVertex {V : Type u_1} [DecidableEq V] (G : SimpleGraph V) (s : V) (t : V) :

The graph formed by forgetting t's neighbours and instead giving it those of s. The s-t edge is removed if present.

Equations
Instances For
    theorem SimpleGraph.not_adj_replaceVertex_same {V : Type u_1} [DecidableEq V] (G : SimpleGraph V) (s : V) (t : V) :

    There is never an s-t edge in G.replaceVertex s t.

    @[simp]
    theorem SimpleGraph.adj_replaceVertex_iff_of_ne_left {V : Type u_1} [DecidableEq V] (G : SimpleGraph V) (s : V) {t : V} {w : V} (hw : w t) :
    (SimpleGraph.replaceVertex G s t).Adj s w G.Adj s w

    Except possibly for t, the neighbours of s in G.replaceVertex s t are its neighbours in G.

    theorem SimpleGraph.adj_replaceVertex_iff_of_ne_right {V : Type u_1} [DecidableEq V] (G : SimpleGraph V) (s : V) {t : V} {w : V} (hw : w t) :
    (SimpleGraph.replaceVertex G s t).Adj t w G.Adj s w

    Except possibly for itself, the neighbours of t in G.replaceVertex s t are the neighbours of s in G.

    theorem SimpleGraph.adj_replaceVertex_iff_of_ne {V : Type u_1} [DecidableEq V] (G : SimpleGraph V) (s : V) {t : V} {v : V} {w : V} (hv : v t) (hw : w t) :
    (SimpleGraph.replaceVertex G s t).Adj v w G.Adj v w

    Adjacency in G.replaceVertex s t which does not involve t is the same as that of G.

    theorem SimpleGraph.edgeSet_replaceVertex_of_adj {V : Type u_1} [DecidableEq V] (G : SimpleGraph V) {s : V} {t : V} (ha : G.Adj s t) :
    def SimpleGraph.addEdge {V : Type u_1} (G : SimpleGraph V) (s : V) (t : V) :

    Given a vertex pair, add the corresponding edge to the graph's edge set if not present.

    Equations
    Instances For
      @[simp]
      theorem SimpleGraph.addEdge_self {V : Type u_1} (G : SimpleGraph V) (s : V) :
      theorem SimpleGraph.addEdge_of_adj {V : Type u_1} (G : SimpleGraph V) {s : V} {t : V} (h : G.Adj s t) :
      theorem SimpleGraph.edgeFinset_addEdge {V : Type u_1} [DecidableEq V] (G : SimpleGraph V) {s : V} {t : V} [Fintype V] [DecidableRel G.Adj] (hn : ¬G.Adj s t) (h : s t) :
      theorem SimpleGraph.card_edgeFinset_addEdge {V : Type u_1} [DecidableEq V] (G : SimpleGraph V) {s : V} {t : V} [Fintype V] [DecidableRel G.Adj] (hn : ¬G.Adj s t) (h : s t) :