pm4py / pm4py-core

Public repository for the PM4Py (Process Mining for Python) project.
https://pm4py.fit.fraunhofer.de
GNU Affero General Public License v3.0
741 stars 287 forks source link

petrinet to bpmn #487

Closed Dehghanpour1990 closed 6 months ago

Dehghanpour1990 commented 6 months ago

Hi, I have a code generating a Petri net as a dictionary. Now I want to convert it to a BPMN file and save it as .bpmn. How can I do it?

fit-alessandro-berti commented 6 months ago

Dear @Dehghanpour1990

You can use the commands:

import pm4py

bpmn_graph = pm4py.convert_to_bpmn(net, initial_marking, final_marking) pm4py.write_bpmn(bpmn_graph, "output.bpmn")

Dehghanpour1990 commented 6 months ago

Dear @fit-alessandro-berti, Thank you for your reply. Your suggestion is for when we get a Petri_net from a discovery method using the PM4PY library right? I have written a code generating Petri_net based on directly-follow-graph and want to convert it into a .bpmn file which will be used in another software.

fit-alessandro-berti commented 6 months ago

Yes, any Petri net object in pm4py

Dehghanpour1990 commented 6 months ago

@fit-alessandro-berti The problem is I have my code developing a discovery algorithm from scratch and the output is not a Petri net object in pm4py, just a Petri net as a dictionary. How can I convert this dictionary to a BPMN file?