pm4py / pm4py-core

Public repository for the PM4Py (Process Mining for Python) project.
https://pm4py.fit.fraunhofer.de
GNU General Public License v3.0
722 stars 286 forks source link

Get Information (Node,Edges) from Heuristic_Net #168

Closed danielkalfas closed 4 years ago

danielkalfas commented 4 years ago

Hello,

i am trying to get all the informationen like nodes, edges and the frequency (or performance) from the heuristic_net after the heuristic_miner has been sucessfully applied . Is there a simple way to retrieve these kind of informationen? The goal is to create a new graph in the frontend with Angular and with clickable nodes in the future. Basically i need to know the nodes and which nodes are connected (including performance/frequency) for every specific setting of the parameters e.g. dependency_thresh.

Any help would be highly appreciated!

fit-alessandro-berti commented 4 years ago

Dear Daniel Kalfas,

You could use the following code snippet:

from pm4py.objects.log.importer.xes import importer as xes_importer from pm4py.algo.discovery.heuristics import algorithm as heu_miner

log = xes_importer.apply("C:/running-example.xes") heu_net = heu_miner.apply_heu(log) print(heu_net) for source_node_name in heu_net.nodes: source_node = heu_net.nodes[source_node_name] for target_node in source_node.output_connections: edge = source_node.output_connections[target_node][0] print(target_node, edge)

Where source_node and target_node are objects of type Node, and edge is an object of type Edge.

You can find the Node object class inside pm4py.objects.heuristics_net.node

You can find the Edge object class inside pm4py.objects.heuristcs_net.edge