Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product ACSets #485

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Product ACSets #485

wants to merge 1 commit into from

Conversation

olynch
Copy link
Member

@olynch olynch commented Aug 17, 2021

It's best to let the test code speak for itself

using Catlab.Theories, Catlab.Present, Catlab.CategoricalAlgebra.PACSets

@present TheoryMatrixGraph(FreeMonoidalSchema) begin
  V::Ob
  EdgeTy::AttrType
  edges::Attr(V  V, EdgeTy)
end

@pacset_type MatrixGraph(TheoryMatrixGraph)

# Intelligently set the number of vertices based on the edge matrix
g = MatrixGraph{Bool}(edges = Bool[0 1 1; 0 0 1; 0 0 0])

@test nparts(g, :V) == 3
@test subpart(g, :edges) == Bool[0 1 1; 0 0 1; 0 0 0]

# Won't accept a non-square matrix
@test_throws AssertionError MatrixGraph{Bool}(edges = Bool[0 0 0])

@epatters epatters changed the title Product ACSets, this time for real Product ACSets Aug 17, 2021
@epatters epatters marked this pull request as draft October 20, 2021 19:09
@epatters epatters added the acsets label Nov 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants