using AlgebraicPetri
using Catlab.CategoricalAlgebra, Catlab.Graphics
sir = LabelledPetriNet([:S, :I, :R],
:inf => ((:S, :I) => (:I, :I)),
:rec => (:I => :R)
)
to_graphviz(sir)
sird = LabelledPetriNet([:S, :I, :R, :D],
:inf => ((:S, :I) => (:I, :I)),
:rec => (:I => :R),
:death => (:R => :D)
)
to_graphviz(sird)
seir = LabelledPetriNet([:S, :E, :I, :R],
:exp => ((:S, :I) => (:E, :I)),
:ill => (:E => :I),
:rec => (:I => :R)
)
to_graphviz(seir)
seird = LabelledPetriNet([:S, :E, :I, :R, :D],
:exp => ((:S, :I) => (:E, :I)),
:ill => (:E => :I),
:rec => (:I => :R),
:death => (:R => :D)
)
to_graphviz(seird)
sub, overlaps = maximum_common_subobject(sir, sird, seir, seird) |> first
morphisms = legs(overlaps[1])
to_graphviz(sub)
morphisms[1](sub) |> to_graphviz
morphisms[2](sub) |> to_graphviz
morphisms[3](sub) |> to_graphviz
morphisms[4](sub) |> to_graphviz