AlgebraicJulia / AlgebraicJulia/Catlab.jl
`join` does not work for subobjects using `ACSetTransformation`
- Lenguaje dominante
- Julia
- Estrellas
- 724
- Forks
- 73
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Based on the zulip discussion, on Catlab v0.16.17. Using `join` on a vector of subobjects does not work. Interestingly as well, `join(subobjs)` and `join(subobjs, SubOpBoolean())` for some reason still dispatch to the `Base.join` that turns them into a string. Only `join(subobjs, SubOpWithLimits())` dispatches correctly to the method defined in Catlab. The naive method of union-ing together the components of the subobjects of interest works.
```julia
using Catlab, StatsBase
@present SchMyGraph <: SchGraph begin
(EAttr,VAttr)::AttrType
vattr::Attr(V,VAttr)
eattr::Attr(E,EAttr)
end
@acset_type MyGraph(SchMyGraph, index=[:src,:tgt]) <: AbstractGraph
mygraph = erdos_renyi(MyGraph{Float64,String}, 70, 0.15)
# to_graphviz(mygraph, prog="fdp")
mygraph[:, :vattr] = "v" .* string.(parts(mygraph, :V))
mygraph[:, :eattr] = rand(nparts(mygraph, :E))
# make many subobjects
subobjs = [
let
v1, v2 = sample(parts(mygraph, :V), 2, replace=false)
edg = edges(mygraph, v1, v2)
Subobject(mygraph, (V=[v1,v2], E=collect(edg)))
end
for _ in 1:20
]
# do not work
join(subobjs)
join(subobjs, SubOpWithLimits())
join(subobjs, SubOpBoolean())
# works
glued_subobj = Subobject(
mygraph,
(
V=unique(vcat(collect.(getindex.(components.(subobjs), :V))...)),
E=unique(vcat(collect.(getindex.(components.(subobjs), :E))...))
)
)
dom(hom(glued_subobj))
# to_graphviz(glued_subobj, prog="fdp")
```
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.