pm4py.convert.convert_log_to_networkx#

pm4py.convert.convert_log_to_networkx(log: EventLog | EventStream | DataFrame, include_df: bool = True, case_id_key: str = 'concept:name', other_case_attributes_as_nodes: Collection[str] | None = None, event_attributes_as_nodes: Collection[str] | None = None) DiGraph[source]#

Converts an event log to a NetworkX DiGraph object.

The nodes of the graph include events, cases, and optionally log attributes. The edges represent: - BELONGS_TO: Connecting each event to its corresponding case. - DF: Connecting events that directly follow each other (if enabled). - ATTRIBUTE_EDGE: Connecting cases/events to their attribute values.

Return type:

DiGraph

Parameters:
  • log – The log object to convert (EventLog, EventStream, or Pandas DataFrame).

  • include_df (bool) – Whether to include the directly-follows relation in the graph. Defaults to True.

  • case_id_key (str) – The attribute to be used as the case identifier. Defaults to “concept:name”.

  • other_case_attributes_as_nodes – Attributes at the case level to include as nodes, excluding the case ID.

  • event_attributes_as_nodes – Attributes at the event level to include as nodes.

Returns:

A nx.DiGraph object representing the event log.