Is there a established data structure for place/transition petri-nets?

587 views Asked by At

I'm trying to come up with an elegant solution for representing place/transition petri nets. So far I save them as follows:

{:netname {:places      {:name tokens, ...}
           :transitions #{:t1, :t2, :t3, ...}
           :edges_in    #{[:from :to tokens], ...}
           :edges_out   #{[:from :to tokens], ...}}}

tokens is a number, everything starts with a symbol with the corresponding name.

//edit - Some more clarification: The :netname and :name are unique, because it has to be possible to merge 2 nets, where the places again have to have unique names. The numerical tokens are determined by the user of the petri nets during creation of a place or edge.

I would be thankful for some pointers or links to a more elaborate / better data structure for my problem.

//edit 2 - I reworked my first take on the data-structure, because of the uniquenes of place-names. :places now references a hashmap. Also edges_in and out are now hashmaps, because every edge is unique with its origin, destination and token number.

//edit 3 - The use of the structure: It is read and written to in the same quantity i would say. The way a petri net is used, there is a back and forth between modifying the net and reading it, with maybe slightly more reading towards the end.

I also modified my structure above slightly, so :edges_in and :edges_out now saves the triplets as a vector instead of a list. This simplyfies saving the hashmap to file and reading it from it, because load-string evaluates lists as expressions.

1

There are 1 answers

0
Jon Guiton On

You could look at ISO 15909 interchange format for HLPNs called PNML. This would at least provide you with a basis for a standard interface to your data structures.