Local Open Scope nat.
(** * Properties of subgraphs and degrees *)
(** ** Subgraph predicate [g'] is a subgraph of [g] if: - the vertex set of [g'] is a subset of the vertex set of [g] - the adjacency set of every [v] in [g'] is a subset of adjacency set of every [v] in [g] *)
Definition is_subgraph (g' g : graph) :=
S.Subset (nodes g') (nodes g) /\ forall v, S.Subset (adj g' v) (adj g v).
(** * Induced subgraphs *)
(** ** Definition *)
Definition subgraph_of (g : graph) (s : S.t) :=
M.fold (fun v adj g' => if S.mem v s then M.add v (S.inter s adj) g' else g') g empty_graph.

(** ** Nodes of an induced subgraph are a subset of the original graph *)
Lemma subgraph_vertices : forall g s, S.Subset (nodes (subgraph_of g s)) (nodes g).