pm4py.discovery.discover_prefix_tree#

pm4py.discovery.discover_prefix_tree(log: EventLog | DataFrame, activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name') Trie[source]#

Discovers a Prefix Tree from the provided log.

A Prefix Tree represents all the unique prefixes of activity sequences in the log.

Parameters:
  • log – Event log or Pandas DataFrame.

  • activity_key (str) – Attribute to be used for the activity (default: “concept:name”).

  • timestamp_key (str) – Attribute to be used for the timestamp (default: “time:timestamp”).

  • case_id_key (str) – Attribute to be used as case identifier (default: “case:concept:name”).

Returns:

A Trie object representing the discovered prefix tree.

Return type:

Trie

import pm4py

prefix_tree = pm4py.discover_prefix_tree(
    dataframe,
    activity_key='concept:name',
    case_id_key='case:concept:name',
    timestamp_key='time:timestamp'
)