Discovers a Directly-Follows Graph (DFG) from a log.
A Directly-Follows Graph (DFG) is the simplest representation of the process models. In a directly-follows graph, each node represents an activity and the arcs describe the relationship between various activities. Typically in a process model, the directly-follows graph has a source and sink representing the start and end activities.
在一个DFG图中,每个节点表示一个活动,其中的边表示活动之间的直接跟随关系。
搭配特殊的 filter 可以调整输出结果:(例子中 展示了 1、2 两种)
1. Filters a DFG (complete, and so connected) on the specified percentage of activities
2. Filters a DFG (complete, and so connected) on the specified percentage of paths
3. Filters a DFG (complete, and so connected) on the specified dependency threshold (Heuristics Miner dependency)
4. Filters the DFG, making "target_activity" the only possible end activity of the graph
5. Filters the DFG, making "source_activity" the only possible source activity of the graph
6. Filters the DFG keeping only nodes that can reach / are reachable from activity
7. Clean Directly-Follows graph based on noise threshold
log = pm4py.read_xes("../tests/input_data/receipt.xes")
dfg, sa, ea = pm4py.discover_dfg(log)
act_count = pm4py.get_event_attribute_values(log, "concept:name")
# keep the specified amount of activities
dfg, sa, ea, act_count = dfg_filtering.filter_dfg_on_activities_percentage(dfg, sa, ea, act_count, 0.8)
# keep the specified amount of paths
dfg, sa, ea, act_count = dfg_filtering.filter_dfg_on_paths_percentage(dfg, sa, ea, act_count, 0.8)
# view the DFG
gviz = dfg_visualizer.apply(dfg, activities_count=act_count, parameters={dfg_visualizer.Variants.FREQUENCY.value.Parameters.START_ACTIVITIES: sa,
dfg_visualizer.Variants.FREQUENCY.value.Parameters.END_ACTIVITIES: ea,
dfg_visualizer.Variants.FREQUENCY.value.Parameters.FORMAT: examples_conf.TARGET_IMG_FORMAT})
dfg_visualizer.view(gviz)
if __name__ == "__main__":
# execute_script()
log = pm4py.read_xes("../tests/input_data/receipt.xes")
dfg, sa, ea = pm4py.discover_dfg(log)
act_count = pm4py.get_event_attribute_values(log, "concept:name")
# keep the specified amount of activities
dfg, sa, ea, act_count = dfg_filtering.filter_dfg_on_activities_percentage(dfg, sa, ea, act_count, 0.8)
# keep the specified amount of paths
dfg, sa, ea, act_count = dfg_filtering.filter_dfg_on_paths_percentage(dfg, sa, ea, act_count, 0.8)
# view the DFG
gviz = dfg_visualizer.apply(dfg, activities_count=act_count, parameters={dfg_visualizer.Variants.FREQUENCY.value.Parameters.START_ACTIVITIES: sa,
dfg_visualizer.Variants.FREQUENCY.value.Parameters.END_ACTIVITIES: ea,
dfg_visualizer.Variants.FREQUENCY.value.Parameters.FORMAT: examples_conf.TARGET_IMG_FORMAT})
dfg_visualizer.view(gviz)