pm4py.objects.process_tree.utils.generic 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.process_tree.utils.generic.fold(tree)[source]#

This method reduces a process tree by merging nodes of the form N(N(a,b),c) into N(a,b,c), i.e., where N = || or X. For example X(X(a,b),c) == X(a,b,c). Furthermore, meaningless parts, e.g., internal nodes without children, or, operators with one child are removed as well.

Parameters:

tree

Returns:

pm4py.objects.process_tree.utils.generic.reduce_tau_leafs(tree)[source]#

This method reduces tau leaves that are not meaningful. For example tree ->(a, au,b) is reduced to ->(a,b). In some cases this results in constructs such as ->(a), i.e., a sequence with a single child. Such constructs are not further reduced.

Parameters:

tree

Returns:

pm4py.objects.process_tree.utils.generic.is_tau_leaf(tree)[source]#
pm4py.objects.process_tree.utils.generic.is_leaf(tree)[source]#
pm4py.objects.process_tree.utils.generic.project_execution_sequence_to_leafs(execution_sequence)[source]#

Project an execution sequence to the set of leafs of the tree.

Parameters:

execution_sequence – Execution sequence on the process tree

Returns:

Leafs nodes of the process tree

Return type:

list_leafs

pm4py.objects.process_tree.utils.generic.project_execution_sequence_to_labels(execution_sequence)[source]#

Project an execution sequence to a set of labels

Parameters:

execution_sequence – Execution sequence on the process tree

Returns:

List of labels contained in the process tree

Return type:

list_labels

pm4py.objects.process_tree.utils.generic.parse(string_rep)[source]#

Parse a string provided by the user to a process tree (initialization method)

Parameters:

string_rep – String representation of the process tree

Returns:

Process tree object

Return type:

node

pm4py.objects.process_tree.utils.generic.parse_recursive(string_rep, depth_cache, depth)[source]#

Parse a string provided by the user to a process tree (recursive method)

Parameters:
  • string_rep – String representation of the process tree

  • depth_cache – Depth cache of the algorithm

  • depth – Current step depth

Returns:

Process tree object

Return type:

node

pm4py.objects.process_tree.utils.generic.tree_sort(tree)[source]#

Sort a tree in such way that the order of the nodes in AND/XOR children is always the same. This is a recursive function

Parameters:

tree – Process tree

pm4py.objects.process_tree.utils.generic.structurally_language_equal(tree1, tree2)[source]#

this function checks if two given process trees are structurally equal, modulo, shuffling of children (if allowed), i.e., in the parallel, or and xor operators, the order does not matter.

Parameters:
  • tree1

  • tree2

Returns:

pm4py.objects.process_tree.utils.generic.get_process_tree_height(pt: ProcessTree) → int[source]#

calculates from the given node the max height downwards :param pt: process tree node :return: height

pm4py.objects.process_tree.utils.generic.process_tree_to_binary_process_tree(tree: ProcessTree) → ProcessTree[source]#
pm4py.objects.process_tree.utils.generic.common_ancestor(t1: ProcessTree, t2: ProcessTree) → ProcessTree | None[source]#
pm4py.objects.process_tree.utils.generic.get_ancestors_until(t: ProcessTree, until: ProcessTree, include_until: bool = True) → List[ProcessTree] | None[source]#
pm4py.objects.process_tree.utils.generic.get_leaves(t: ProcessTree, leaves=None)[source]#
pm4py.objects.process_tree.utils.generic.get_leaves_as_tuples(t: ProcessTree, leaves=None)[source]#
pm4py.objects.process_tree.utils.generic.is_operator(tree: ProcessTree, operator: Operator) → bool[source]#
pm4py.objects.process_tree.utils.generic.is_any_operator_of(tree: ProcessTree, operators: List[Operator]) → bool[source]#
pm4py.objects.process_tree.utils.generic.is_in_state(tree: ProcessTree, target_state: OperatorState, tree_state: Dict[Tuple[int, ProcessTree], OperatorState]) → bool[source]#
pm4py.objects.process_tree.utils.generic.is_root(tree: ProcessTree) → bool[source]#