AlgebraicJulia / AlgebraicJulia/Catlab.jl

Use symmetry of copying in crossing minimization in `to_hom_expr`

Offen
#644 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement wiring diagrams
Vorherrschende Sprache
Julia
Sterne
724
Forks
73
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

I'm using the following code to generate a TikZ diagram:

```julia
using Catlab, Catlab.Theories
using Catlab.Programs
using Catlab.WiringDiagrams
using Catlab.Graphics
import TikzPictures, Convex, SCS

@present P(FreeSymmetricMonoidalCategory) begin
(M,S,H)::Ob
psi::Hom(M,H)
kappa::Hom(H,otimes(H,S))
u::Hom(otimes(S,M), M)
end

# hack to make the greek letters render correctly
P[:psi].args[1] = Symbol("\\psi")
P[:kappa].args[1] = Symbol("\\kappa")

diagram = @program P (m1::M) begin
h1 = psi(m1)
h2, s = kappa(h1)
m2 = u(s, m1)
h3 = psi(m2)
return h3, m2
end

tikz_diag = to_tikz(
to_hom_expr(FreeCartesianCategory,diagram),
labels=true,
)
```

The diagram comes out looking like this:

image

Why is that swap there after the second copy morphism, and is there a way to remove it? (Or better still, have it removed automatically.)

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.