pm4py.convert.convert_to_petri_net#

pm4py.convert.convert_to_petri_net(obj: BPMN | ProcessTree | HeuristicsNet | DcrGraph | POWL | dict, *args, **kwargs) Tuple[PetriNet, Marking, Marking][source]#

Converts an input model to an (accepting) Petri net. The input objects can either be a process tree, BPMN model, a Heuristic net or a Dcr Graph. The output is a triple, containing the Petri net and the initial and final markings. The markings are only returned if they can be reasonable derived from the input model.

Parameters:

args – process tree, Heuristics net, BPMN, POWL model or Dcr Graph

Return type:

Tuple[PetriNet, Marking, Marking]

import pm4py

# imports a process tree from a PTML file
process_tree = pm4py.read_ptml("tests/input_data/running-example.ptml")
net, im, fm = pm4py.convert_to_petri_net(process_tree)