AlgebraicJulia / AlgebraicJulia/Catlab.jl

Removing box from DWD changes port order

Ouverte
#530 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug wiring diagrams
Langage dominant
Julia
Étoiles
724
Forks
73
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

The [`rem_box!`](https://github.com/AlgebraicJulia/Catlab.jl/blob/master/src/wiring_diagrams/Directed.jl#L457) function for DWDs can change the order of ports of other boxes.
This is likely because the DWD depends on the relative order of the Port parts to determine the order of box ports, but the [`rem_parts!`](https://github.com/AlgebraicJulia/Catlab.jl/blob/master/src/categorical_algebra/ACSetInterface.jl#L194) often does not preserve this order. A minimal example which demonstrates this is given below:
```julia
using Catlab
using Catlab.WiringDiagrams

A, B, C = [:A], [:B], [:C]
f = Box(:f, A, B)
g = Box(:g, [A,B], C)

d = WiringDiagram([A, B], [C,B])
fv = add_box!(d, f)
gv = add_box!(d, g)

add_wire!(d, (input_id(d),1) => (fv,1))
add_wire!(d, (fv,1) => (output_id(d),2))
add_wire!(d, (input_id(d),1) => (gv,1))
add_wire!(d, (input_id(d),2) => (gv,2))
add_wire!(d, (gv,1) => (output_id(d),1))

@show input_ports(d, 2)
rem_box!(d, 1)
@show input_ports(d, 1)
```
On my computer, this outputs:

```julia
input_ports(d, 2) = Any[[:A], [:B]]
input_ports(d, 1) = Any[[:B], [:A]]
```

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.