Category Theory
Zulip Server
Archive

You're reading the public-facing archive of the Category Theory Zulip server.
To join the server you need an invite. Anybody can get an invite by contacting Matteo Capucci at name dot surname at gmail dot com.
For all things related to this archive refer to the same person.


Stream: learning: reading & references

Topic: Learning Out Loud: C-Sets


view this post on Zulip Julius Hamilton (Aug 30 2024 at 02:59):

I will read part of the following blog post: https://blog.algebraicjulia.org/post/2020/09/cset-graphs-1/

Formally, a simple graph G=(V,E)G = (V, E) is a set of vertices VV equipped with an edge relation EV×VE \subseteq V \times V for which:

(u,vVu, v \in V).

(Tangential comment: The edge relation is symmetric and irreflexive, whereas a partial order includes being reflexive and antisymmetric! Hm.)

In a simple digraph the symmetry axiom is dropped, so that the edges are directed. Graphs and digraphs are basic objects in discrete mathematics, are the source of fundamental data structures in computer science.

Despite this, the concept of a simple graph is often unsatisfactory for both theoretical and practical reasons. The category of simple graphs is badly behaved. Moreover, there is not a single concept of graph suitable for all applications, but rather that graphs belong to a rich family of related concepts.

For a category theorist, a graph GG consists of two sets, a vertex set G(V)G(V), and an edge set G(E)G(E), together with two functions G(src),G(tgt):G(E)G(V)G(\text{src}), G(\text{tgt}) : G(E) \to G(V). Define esrce \bullet \text{src} as G(src(e)G(\text{src}(e) and etgte \bullet \text{tgt} as G(tgt(e)G(\text{tgt}(e). Thus, a graph is directed, may have multiple edges between two vertices, and may have loops, making it what a graph theorist would call a “multidigraph.”

In Catlab, the definition of a graph is captured by the schema:

using Catlab.CategoricalAlgebra

@present SchGraph(FreeSchema) begin
  V::Ob
  E::Ob
  src::Hom(E,V)
  tgt::Hom(E,V)
end

It appears that one can build a category in this language by stating the names of objects with ::Ob and the names of morphisms with ::Hom(X,Y).

Having defined the schema for graphs, the module Graphs in Catlab creates a Julia data type for graphs like this:

@acset_type Graph(SchGraph, index=[:src,:tgt])

It appears that this constructs an instance of the schema, though I’m not familiar with the @acset_type or index=[:src,:tgt] expressions.

Then there are some very nice code examples of how to define and visualize graphs in AlgebraicJulia.

Graphs are an example of a class of structures called CC-sets. CC-sets are defined relative to a small category CC. In this context, the category CC is interpreted as a schema, describing the kinds of parts in the structure and the subpart relations between them.

The author refers to maps src,tgt\text{src},\text{tgt} as “subpart relations”, because they map an entity (an edge) to two things it implicitly has (a source and target).

The interpretation is that there are two kinds of parts, of type VV and EE. Parts of type VV have no subparts, while parts of type EE have two subparts of type VV called src\text{src} and tgt\text{tgt}.

Given a small category CC, a CC-set is a functor X:CSetX : C \to \textsf{Set}.

Going to sleep now, will continue in the morning.