pm4py.visualization.networkx.variants.digraph module#

class pm4py.visualization.networkx.variants.digraph.Parameters(*values)[source]#

Bases: Enum

FORMAT = 'format'#
BGCOLOR = 'bgcolor'#
RANKDIR = 'rankdir'#
INCLUDE_NODE_ATTRIBUTES = 'include_node_attributes'#
INCLUDE_EDGE_ATTRIBUTES = 'include_edge_attributes'#
pm4py.visualization.networkx.variants.digraph.apply(G: DiGraph, parameters: Dict[Any, Any] | None = None) Digraph[source]#

Creates a Graphviz Digraph from a NetworkX DiGraph object.

Minimum viable example:

import pm4py from pm4py.visualization.networkx import visualizer as nx_to_gv_vis

log = pm4py.read_xes(“../tests/input_data/running-example.xes”) # gets an ‘event graph’ where events, cases and their relationships # are represented in a graph (NetworkX DiGraph) event_graph = pm4py.convert_log_to_networkx(log)

# visualize the NX DiGraph using Graphviz gviz = nx_to_gv_vis.apply(event_graph, parameters={“format”: “svg”}) nx_to_gv_vis.view(gviz)

Parameters:
  • G – NetworkX DiGraph

  • parameters – Parameters of the visualization, including: - Parameters.FORMAT => format of the visualization (.png, .svg) - Parameters.BGCOLOR => background color of the visualization (transparent, white) - Parameters.RANKDIR => direction of the graph (LR or TB) - Parameters.INCLUDE_NODE_ATTRIBUTES => includes the node attributes in the node’s label in the representation - Parameters.INCLUDE_EDGE_ATTRIBUTES => includes the edge attributes in the edge’s label in the representation

Returns:

Graphviz DiGraph object

Return type:

digraph