pm4py.vis.save_vis_dfg#

pm4py.vis.save_vis_dfg(dfg: dict, start_activities: dict, end_activities: dict, file_path: str, bgcolor: str = 'white', max_num_edges: int = 9223372036854775807, rankdir: str = 'LR', graph_title: str | None = None, **kwargs)[source]#

Saves a DFG visualization to a file.

Parameters:
  • dfg (dict) – DFG object

  • start_activities (dict) – Start activities

  • end_activities (dict) – End activities

  • file_path (str) – Destination path

  • bgcolor (str) – Background color of the visualization (default: white)

  • max_num_edges (int) – Maximum number of edges to represent in the graph

  • rankdir (str) – Sets the direction of the graph (“LR” for left-to-right; “TB” for top-to-bottom)

  • graph_title – Sets the title of the visualization (if provided)

import pm4py

dfg, start_activities, end_activities = pm4py.discover_dfg(dataframe, case_id_key='case:concept:name', activity_key='concept:name', timestamp_key='time:timestamp')
pm4py.save_vis_dfg(dfg, start_activities, end_activities, 'dfg.png')