pm4py.objects.process_tree.utils package

Submodules

pm4py.objects.process_tree.utils.bottomup module

This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).

PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

PM4Py 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.

pm4py.objects.process_tree.utils.bottomup.get_bottomup_nodes(tree, parameters=None)[source]

Gets the nodes of a tree in a bottomup order (leafs come first, the master node comes after)

Parameters:
  • tree – Process tree
  • parameters – Parameters of the algorithm
Returns:

Nodes of the tree in a bottomup order

Return type:

bottomup_nodes

pm4py.objects.process_tree.utils.bottomup.get_max_length_dict(node, max_length_dict, num_nodes)[source]

Populates, given the nodes of a tree in a bottom-up order, the maximum length dictionary (every trace generated from that point of the tree has at most length N)

Parameters:
  • node – Node
  • max_length_dict – Dictionary that is populated in-place
  • num_nodes – Number of nodes in the process tree
pm4py.objects.process_tree.utils.bottomup.get_max_rem_dict(tree, parameters=None)[source]

Gets for each node of the tree the maximum number of activities that are inserted to ‘complete’ a trace of the overall tree

Parameters:
  • tree – Process tree
  • parameters – Parameters of the algorithm
Returns:

Dictionary described in the docstring

Return type:

max_rem_dict

pm4py.objects.process_tree.utils.bottomup.get_max_trace_length(tree, parameters=None)[source]

Get the maximum length of a trace allowed by the process tree (can be infty)

Parameters:
  • tree – Process tree
  • parameters – Possible parameters of the algorithm
Returns:

The maximum length of a trace

Return type:

max_trace_length

pm4py.objects.process_tree.utils.bottomup.get_min_length_dict(node, min_length_dict)[source]

Populates, given the nodes of a tree in a bottom-up order, the minimum length dictionary (every trace generated from that point of the tree has at least length N)

Parameters:
  • node – Node
  • min_length_dict – Dictionary that is populated in-place
pm4py.objects.process_tree.utils.bottomup.get_min_rem_dict(tree, parameters=None)[source]

Gets for each node of the tree the minimum number of activities that are inserted to ‘complete’ a trace of the overall tree

Parameters:
  • tree – Process tree
  • parameters – Parameters of the algorithm
Returns:

Dictionary described in the docstring

Return type:

min_rem_dict

pm4py.objects.process_tree.utils.bottomup.get_min_trace_length(tree, parameters=None)[source]

Get the minimum length of a trace allowed by the process tree

Parameters:
  • tree – Process tree
  • parameters – Possible parameters of the algorithm
Returns:

The minimum length of a trace

Return type:

min_trace_length

pm4py.objects.process_tree.utils.generic module

This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).

PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

PM4Py 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.

pm4py.objects.process_tree.utils.generic.common_ancestor(t1: pm4py.objects.process_tree.obj.ProcessTree, t2: pm4py.objects.process_tree.obj.ProcessTree) → Optional[pm4py.objects.process_tree.obj.ProcessTree][source]
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.get_ancestors_until(t: pm4py.objects.process_tree.obj.ProcessTree, until: pm4py.objects.process_tree.obj.ProcessTree, include_until: bool = True) → Optional[List[pm4py.objects.process_tree.obj.ProcessTree]][source]
pm4py.objects.process_tree.utils.generic.get_leaves(t: pm4py.objects.process_tree.obj.ProcessTree, leaves=None)[source]
pm4py.objects.process_tree.utils.generic.get_leaves_as_tuples(t: pm4py.objects.process_tree.obj.ProcessTree, leaves=None)[source]
pm4py.objects.process_tree.utils.generic.get_process_tree_height(pt: pm4py.objects.process_tree.obj.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.is_any_operator_of(tree: pm4py.objects.process_tree.obj.ProcessTree, operators: List[pm4py.objects.process_tree.obj.Operator]) → bool[source]
pm4py.objects.process_tree.utils.generic.is_in_state(tree: pm4py.objects.process_tree.obj.ProcessTree, target_state: pm4py.objects.process_tree.obj.ProcessTree.OperatorState, tree_state: Dict[Tuple[int, pm4py.objects.process_tree.obj.ProcessTree], pm4py.objects.process_tree.obj.ProcessTree.OperatorState]) → bool[source]
pm4py.objects.process_tree.utils.generic.is_leaf(tree)[source]
pm4py.objects.process_tree.utils.generic.is_operator(tree: pm4py.objects.process_tree.obj.ProcessTree, operator: pm4py.objects.process_tree.obj.Operator) → bool[source]
pm4py.objects.process_tree.utils.generic.is_root(tree: pm4py.objects.process_tree.obj.ProcessTree) → bool[source]
pm4py.objects.process_tree.utils.generic.is_tau_leaf(tree)[source]
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.process_tree_to_binary_process_tree(tree: pm4py.objects.process_tree.obj.ProcessTree) → pm4py.objects.process_tree.obj.ProcessTree[source]
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.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.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.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.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.regex module

This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).

PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

PM4Py 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.

pm4py.objects.process_tree.utils.regex.pt_to_regex(tree, rec_depth=0, shared_obj=None, parameters=None)[source]

Transforms a process tree to a regular expression

NB: The conversion is not yet working with trees containing an AND and/or an OR operator!

Parameters:
  • tree – Process tree
  • parameters – Possible parameters of the algorithm

Module contents

This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).

PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

PM4Py 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.