pm4py.analysis.generate_marking(net: PetriNet, place_or_dct_places: Union[str, Place, Dict[str, int], Dict[Place, int]]) Marking[source]#

Generate a marking for a given Petri net

  • net (PetriNet) – petri net

  • place_or_dct_places – place, or dictionary of places, to be used in the marking. Possible values: single Place object for the marking; name of the place for the marking; dictionary associating to each place its number of tokens; dictionary associating to names of places a number of tokens.

Return type:


import pm4py

net, im, fm = pm4py.read_pnml('model.pnml')
marking = pm4py.generate_marking(net, {'source': 2})