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 #
G.replaceVertex s t
isG
witht
replaced by a copy ofs
, removing thes-t
edge if present.G.addEdge s t
isG
with thes-t
edge added, if that is a valid edge.
The graph formed by forgetting t
's neighbours and instead giving it those of s
. The s-t
edge is removed if present.
Equations
- SimpleGraph.replaceVertex G s t = SimpleGraph.mk fun (v w : V) => if v = t then if w = t then False else G.Adj s w else if w = t then G.Adj v s else G.Adj v w
Instances For
There is never an s-t
edge in G.replaceVertex s t
.
Except possibly for t
, the neighbours of s
in G.replaceVertex s t
are its neighbours in
G
.
Except possibly for itself, the neighbours of t
in G.replaceVertex s t
are the neighbours of
s
in G
.
Adjacency in G.replaceVertex s t
which does not involve t
is the same as that of G
.
Equations
- SimpleGraph.instDecidableRelAdjReplaceVertex G = id inferInstance
Given a vertex pair, add the corresponding edge to the graph's edge set if not present.
Equations
Instances For
Equations
- SimpleGraph.instDecidableRelAdjAddEdge G = id inferInstance