Comments (5)
I believe this has been resolved with a new Catlab feature with cascading_rem_part!
and cascading_rem_parts!
. This will delete a part of the C-Set and cascade to remove all references to that part as well!
Here is an example:
using AlgebraicPetri
using Catlab.CategoricalAlgebra
# Define a petri net
sir_petri = PetriNet(3, ((1, 2), (2, 2)), (2, 3))
# Delete transitions 1 and 2
cascading_rem_parts!(sir_petri, :T, [1,2])
# Delete state 1
cascading_rem_part!(sir_petri, :S, 1)
from algebraicpetri.jl.
You can use rem_parts!
from the Catlab.CategoricalAlgebra module to delete stuff. Comparing models with homomorphisms
from Catlab is also productive. That will give you all the Petri net Homomorphisms between your two models. To compare models you probably actually want to compute a maximumal common submodel, which is a feature that we don't support quite yet.
from algebraicpetri.jl.
thanks james! ill play around with that. it seems like something like add_inputs!
that could have a wrapper function around rem_parts
for AlgebraicPetri.
i have been thinking about writing a library that has some syntax for defining and applying rules to graphs (or maybe categories?), which could easily act on petri nets (i think).
for example, the insert_before
rule would be {{xs__, y}} -> {{xs, z}, {z, y}}
which would match all inneighbors(y)
, plug them into a new vertex z, then connect z to y, leaving outneighbors(y)
unchanged.
then i'd apply_rule(g, rule, vertex)
or something to attempt a match + apply on a specific vertex, or apply_rule(g, rule)
and apply on all vertices.
one extension of this that would be particularly useful is predicated rules like {{y, xs__}} -> {{y, xs/;P1}, {y, z}, {z, xs/;P2}}
which would allow me to wire based on properties of the matched vertices.
this would allow me to easily describe common model modifications that i may want (ie splitting infected to exposed and infected)
im coming from Graphs.jl, but i get the sense that catlab is the right way to define and express this.
from algebraicpetri.jl.
You should look at AlgebraicRewriting.jl. @kris-brown and I have a paper about rewriting on generic combinatorial datastructures that is based on some Graph Transformation literature.
from algebraicpetri.jl.
@anandijain you might also find https://github.com/AlgebraicJulia/Structured-Epidemic-Modeling useful, which contains the examples from the paper https://royalsocietypublishing.org/doi/10.1098/rsta.2021.0309. You can build up complex Petri nets from smaller "atomic" building blocks that represent simpler dynamics (e.g. recovery, death, infection).
from algebraicpetri.jl.
Related Issues (20)
- Adding reflexive transitions to an already stratified model doesn't work because the transition names are tuples HOT 1
- Remove SubACSets from AlgebraicPetri
- `mca_help` within `mca` in SubACSets.jl doesn't recurse.
- It appears MCA recursion can StackOverflow
- `mca` not searching in order of size HOT 2
- `one_removed_subobs` does not remove arcs from Petri net
- Have `mca` find the morphisms and return the spans HOT 1
- Generalize `mca` to work for more than two input ACSets HOT 1
- `vectorfield_expr` only works with LabelledArrays HOT 6
- Utilize PrecompileTools.jl for Caching HOT 1
- Use cascading delete provided by Catlab HOT 1
- `prim_petri` of TypedPetri.jl not labeling types of states correctly
- AlgebraicPetri v0.9
- Issues when running stratified model HOT 1
- oapply_typed results in wrong wiring HOT 2
- Gatlab Migration HOT 4
- Precompilation warnings in package extensions HOT 11
- Core Files in docs build HOT 3
- suggestions for documentation improvement HOT 1
- Use color to distinguish morphisms of Petri nets HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from algebraicpetri.jl.