pm4py.objects.petri_net.utils.networkx_graph module#

pm4py.objects.petri_net.utils.networkx_graph.create_networkx_undirected_graph(net, unique_source, unique_sink)[source]#

Create a NetworkX undirected graph from a Petri net, returning also correspondences for the unique source and the unique sink places that were discovered

Parameters:
  • net – Petri net

  • unique_source – Unique source place

  • unique_sink – Unique sink place

Returns:

  • graph – NetworkX graph

  • unique_source_corr – Correspondence in the NetworkX graph of the unique source place

  • unique_sink_corr – Correspondence in the NetworkX graph of the unique sink place

  • inv_dictionary – Correspondence between NetworkX nodes and Petri net entities

pm4py.objects.petri_net.utils.networkx_graph.create_networkx_directed_graph(net, weight=None)[source]#

Create a NetworkX directed graph from a Petri net

Parameters:

net – Petri net

Returns:

  • graph – NetworkX digraph

  • inv_dictionary – Correspondence between NetworkX nodes and Petri net entities

pm4py.objects.petri_net.utils.networkx_graph.create_networkx_directed_graph_ret_dict_both_ways(net, weight=None)[source]#

Create a NetworkX directed graph from a Petri net

Parameters:

net – Petri net

Returns:

  • graph – NetworkX digraph

  • dictionary – dict mapping Petri net nodes to NetworkX nodes

  • inv_dictionary – dict mapping NetworkX nodes to Petri net nodes