pm4py.objects.petri_net.utils.networkx_graph module#

PM4Py – A Process Mining Library for Python Copyright (C) 2026 Process Intelligence Solutions GmbH

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see this software project’s root or visit <https://www.gnu.org/licenses/>.

Website: https://processintelligence.solutions Contact: info@processintelligence.solutions

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