definition

A structured cospan (Baez–Courser; Catlab’s StructuredCospan) is a cospan in a category of “structured objects” (graphs, Petri nets, circuits) where is a functor from a category of interfaces (typically , sending a set to the discrete graph). Structured cospans compose by pushout in and form a Hypergraph Category; they generalize decorated cospans (which decorate the apex of a cospan in ) and cover open graphs, open Petri nets and open circuits. Kittenlab Lecture 15 motivates them as “the second step” after cospan categories; Catlab’s OpenACSetTypes(T, :V) builds the open version of any ACSet type.

Sources: Kittenlab Lecture 15; Catlab documentation; 7 Sketches §6.4, §6.6 (further reading: [FS18a; FS18b]).

Docs: FinSets · Structured cospans · Graphs — Kittenlab Lecture 15

using Catlab
const OpenGraphOb, OpenGraph = OpenACSetTypes(Graph, :V)   # L : FinSet → Graph is the discrete-graph functor
g = OpenGraph(path_graph(Graph, 2), FinFunction([1], 2), FinFunction([2], 2))
compose(g, g) |> apex |> nv     # 3