pm4py.convert.convert_to_petri_net#

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

Converts an input model to an (accepting) Petri net.

The input objects can be a process tree, BPMN model, Heuristic net, POWL model, or a dictionary representing a Directly-Follows Graph (DFG). The output is a tuple containing the Petri net and the initial and final markings. The markings are only returned if they can be reasonably derived from the input model.

Parameters:

args

  • If converting from a BPMN, ProcessTree, HeuristicsNet, or POWL: a single object of the respective type.

  • If converting from a DFG: a dictionary representing the DFG, followed by lists of start and end activities.

Returns:

A tuple of (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)