pm4py.read.read_dfg#
- pm4py.read.read_dfg(file_path: str, encoding: str = 'utf-8') Tuple[Dict[Tuple[str, str], int], Dict[str, int], Dict[str, int]] [source]#
Reads a Directly-Follows Graph (DFG) from a .dfg file. The returned DFG object is a tuple containing:
DFG (Dict[Tuple[str, str], int]): Maps pairs of activities to their occurrence count. For example, DFG[(‘a’, ‘b’)] = k indicates that activity ‘a’ is directly followed by activity ‘b’ a total of k times in the log.
Start Activity Dictionary (Dict[str, int]): Maps activities to the number of traces they start. For example, S[‘a’] = k implies that activity ‘a’ starts k traces in the event log.
End Activity Dictionary (Dict[str, int]): Maps activities to the number of traces they end. For example, E[‘z’] = k implies that activity ‘z’ ends k traces in the event log.
- Parameters:
file_path (
str
) – Path to the DFG model file on disk.encoding (
str
) – Encoding to be used (default: utf-8).
- Return type:
Tuple[Dict[Tuple[str, str], int], Dict[str, int], Dict[str, int]]
import pm4py dfg = pm4py.read_dfg("<path_to_dfg_file>")