Conversion of a DFG into a workflow net

Conversion of a DFG into a workflow net

The Directly-Follows Graph is the representation of a process provided by many commercial tools. An idea of Sander Leemans is about converting the DFG into a workflow net that perfectly mimic the DFG in order to able to perform alignments between the behavior described in the model and the behavior described in the log. This is called DFG mining.

The following steps are useful to load the log, calculate the DFG, convert it into a workflow net and perform alignments.

The running-example log could be loaded:

from pm4py.objects.log.importer.xes import factory as xes_importer

log = xes_importer.apply("C:\\running-example.xes")

A Directly-Follows could be mined from the log:

from pm4py.algo.discovery.dfg import factory as dfg_factory

dfg = dfg_factory.apply(log)

The DFG could be converted into a workflow net:

from pm4py.objects.conversion.dfg import factory as dfg_mining_factory

net, im, fm = dfg_mining_factory.apply(dfg)

On this workflow net, it is possible to apply alignments:

from pm4py.algo.conformance.alignments import factory as align_factory

alignments = align_factory.apply(log, net, im, fm)

print(alignments)

With the following result:

[{‘alignment’: [(‘register request’, ‘register request’), (‘examine casually’, ‘examine casually’), (‘check ticket’, ‘check ticket’), (‘decide’, ‘decide’), (‘reinitiate request’, ‘reinitiate request’), (‘examine thoroughly’, ‘examine thoroughly’), (‘check ticket’, ‘check ticket’), (‘decide’, ‘decide’), (‘pay compensation’, ‘pay compensation’), (‘>>’, None)], ‘cost’: 1, ‘visited_states’: 11, ‘queued_states’: 40, ‘traversed_arcs’: 42, ‘fitness’: 1}, {‘alignment’: [(‘register request’, ‘register request’), (‘check ticket’, ‘check ticket’), (‘examine casually’, ‘examine casually’), (‘decide’, ‘decide’), (‘pay compensation’, ‘pay compensation’), (‘>>’, None)], ‘cost’: 1, ‘visited_states’: 7, ‘queued_states’: 22, ‘traversed_arcs’: 23, ‘fitness’: 1}, {‘alignment’: [(‘register request’, ‘register request’), (‘examine thoroughly’, ‘examine thoroughly’), (‘check ticket’, ‘check ticket’), (‘decide’, ‘decide’), (‘reject request’, ‘reject request’), (‘>>’, None)], ‘cost’: 1, ‘visited_states’: 7, ‘queued_states’: 22, ‘traversed_arcs’: 23, ‘fitness’: 1}, {‘alignment’: [(‘register request’, ‘register request’), (‘examine casually’, ‘examine casually’), (‘check ticket’, ‘check ticket’), (‘decide’, ‘decide’), (‘pay compensation’, ‘pay compensation’), (‘>>’, None)], ‘cost’: 1, ‘visited_states’: 7, ‘queued_states’: 22, ‘traversed_arcs’: 23, ‘fitness’: 1}, {‘alignment’: [(‘register request’, ‘register request’), (‘examine casually’, ‘examine casually’), (‘check ticket’, ‘check ticket’), (‘decide’, ‘decide’), (‘reinitiate request’, ‘reinitiate request’), (‘check ticket’, ‘check ticket’), (‘examine casually’, ‘examine casually’), (‘decide’, ‘decide’), (‘reinitiate request’, ‘reinitiate request’), (‘examine casually’, ‘examine casually’), (‘check ticket’, ‘check ticket’), (‘decide’, ‘decide’), (‘reject request’, ‘reject request’), (‘>>’, None)], ‘cost’: 1, ‘visited_states’: 15, ‘queued_states’: 58, ‘traversed_arcs’: 61, ‘fitness’: 1}, {‘alignment’: [(‘register request’, ‘register request’), (‘check ticket’, ‘check ticket’), (‘examine thoroughly’, ‘examine thoroughly’), (‘decide’, ‘decide’), (‘reject request’, ‘reject request’), (‘>>’, None)], ‘cost’: 1, ‘visited_states’: 7, ‘queued_states’: 22, ‘traversed_arcs’: 23, ‘fitness’: 1}]

.