Expand description
Petri-net reconstruction from per-class callSequences blobs, with token-replay
conformance scoring.
For every node whose blob holds ≥2 call sequences we run an alpha-miner-style pass:
- Collect activities (every distinct call), direct-succession pair counts, plus first/last-activity multisets.
- Classify each ordered pair
(a, b)as causal (succession seen one way only) or parallel (seen both ways). - Build the Petri net:
- one transition
t_<act>per activity - start place
p_start→ every first-activity transition - every last-activity transition → end place
p_end - one intermediate place
p_<i>per causal pair, wiredt_a → p_i → t_b
- one transition
- Re-classify each transition by local arc topology:
choice(input place feeds >1 transition),loop(output leads back to an input),parallel(output feeds >1 transition), elsemandatory. - Score conformance: a sequence conforms iff every consecutive
(a, b)has a validt_a → place → t_bpath in the net. Sequences shorter than two calls trivially conform (matches the Python reference).
Mirrors analysis/process_mining.py in the visiting tool.
See DESIGN.md (Phase 3) at the workspace root.
Structs§
- Arc
- A directed arc between a place and a transition (or vice versa).
- Node
Process Mining - Per-node net produced by
compute_process_mining. - Petri
Net - A mined Petri net for a single set of call sequences.
- Place
- A Petri-net place.
kindis one of"start","end","intermediate". - Process
Mining Analysis - Whole-graph process-mining readout.
- Transition
- A Petri-net transition.
kindstarts as"activity"; afterclassify_transitionsruns it becomes one of"mandatory","choice","loop", or"parallel".
Functions§
- build_
petri_ net - Build a Petri net from a list of call sequences. Returns an empty net when
sequencesis empty or no sequence contains any calls. - classify_
transitions - Reclassify the
kindfield of every transition innetfrom"activity"to one ofmandatory/choice/loop/parallel. Mutates in place. - compute_
conformance - Compute the fraction of
sequencesthat conform tonet. Sequences with<2calls trivially conform. Returns0.0whensequencesis empty or the net has no arcs. - compute_
process_ mining - Walk every node’s
callSequencesblob, mine a Petri net per class that emits ≥2 sequences, classify transitions, and score conformance.