Returns a constructor function that creates ACSets with the given schema.
This is the R equivalent of Julia's @acset_type.
Usage
acset_type(schema, name = NULL, index = character())Examples
sch <- BasicSchema(
obs = c("E", "V"),
homs = list(hom("src", "E", "V"), hom("tgt", "E", "V")),
attrtypes = c("Name"),
attrs = list(attr_spec("name", "V", "Name"))
)
Graph <- acset_type(sch, index = c("src", "tgt"))
# Create an empty graph
g <- Graph()
# Create a pre-populated graph
g2 <- Graph(V = 3, E = 2, src = c(1L, 2L), tgt = c(2L, 3L),
name = c("a", "b", "c"))
nparts(g2, "V")
#> [1] 3