definition example theorem

(7 Sketches: ) is the Functor Category where is the schema (two objects, arrows , no equations): its objects are graphs and its morphisms are graph homomorphisms. “You may find yourself back in the primordial ooze”: graphs present categories, and graphs are themselves instances on a schema which is a graph.

Sources: 7 Sketches §3.3.5 (Eq. 3.61, Example 3.63, Exercises 3.62, 3.64), §3.2.4 (“connection”); Kittenlab Lectures 6–9, 12–13; Catlab Graph; CTfS Examples 4.1.1.9, 4.1.2.22, 4.5.1.5, 4.5.1.21, 4.5.3.4, §4.2.1.19

  • A graph as a table: Arrow table with columns source, target; Vertex table with only IDs (Eq. 3.61 = Example 1.37). Even the schema of easySchema is a -instance (7S Exercise 3.62).
  • has coproducts , (Kittenlab Lecture 8), products , with componentwise source/target (Lecture 13), pushouts that glue graphs along a common subgraph (Lecture 9), and all other finite limits and colimits pointwise; it is a Topos.
  • The representables (one vertex) and (one edge, two vertices) satisfy and (Yoneda Lemma, Kittenlab Lecture 12); is the set of length- paths (Lecture 8). A three-colouring is a homomorphism into the triangle graph (Lecture 6).
  • Data migration along turns a Discrete Dynamical System into a graph (§3.4.1). is left adjoint to the underlying graph (Example 3.74).
  • Telling graphs apart with functors (CTfS Example 4.1.2.22). The vertex set, the arrow set, the set of loops and the set of connected components are four functors ; functors preserve isomorphisms, so if two graphs have different numbers of loops (or components, vertices, arrows) they are not isomorphic. “It is a bit like deciding whether a number is prime by checking whether it is even or its digits add up to a multiple of 3”: cheap invariants transported from .
  • Universal graphs (CTfS Example 4.5.3.4): the empty graph is initial; the terminal graph is the one-vertex one-loop graph (a homomorphism into it has no choices to make). The product has vertex set and arrow set — for (3 vertices, 3 arrows) and (4 vertices, 4 arrows) it has vertices and arrows, and the two projections are visible by reading only the first or second coordinate of each row of the tables (CTfS Example 4.5.1.5).
  • Spreading a graph over time (CTfS Example 3.3.1.7): the product with the graph has vertices and arrows — every transition takes one tick.
  • Symmetric graphs are functors on a slightly bigger indexing category with an arrow-reversing involution (CTfS Example 4.2.1.21).
  • Related categories: weighted graphs, port graphs, open graphs (cospans of graphs), Petri nets.

Docs: Limits & colimits · C-set morphisms · ACSets API · Graphs — Kittenlab Lecture 6, Lecture 8, Lecture 12

using Catlab
# the schema Gr and the ACSet type Graph are built in
SchGraph                                            # V, E, src, tgt
G = @acset Graph begin V = 4; E = 5; src = [1,1,1,2,2]; tgt = [2,3,3,2,3] end   # Eq. (3.61)
H = cycle_graph(Graph, 3)
coproduct(G, H) |> apex                             # disjoint union
product(G, H) |> apex                               # product graph
homomorphisms(G, H)                                 # graph homomorphisms
-- Mathlib: `Quiver` and `Prefunctor` give the category of (multi)graphs as quivers
#check CategoryTheory.Quiv          -- the category of quivers
#check Prefunctor                   -- a graph homomorphism
-- a graph homomorphism as two functions respecting src/tgt (see Graph Homomorphism)
data GraphHom v e v' e' = GraphHom { onV :: v -> v', onE :: e -> e' }