graphs: separate internal node IDs from display labels #51

Open
opened 2026-10-06 13:53:12 +00:00 by ffrauenberger · 0 comments
Owner

Severity: improvement (medium: the triggers can each be fixed with small changes first; the full refactor is large)

Where

  • app/graphs/visualization/base_graph.py (add_node, substitute_colons, get_node, get_edge)
  • app/config.py:19-20
  • app/ui/base_algorithm_ui/base_algorithm_controller.py:242-253
  • The graph converters in app/converters/ (not the CSV/XES converters)
  • app/ui/genetic_miner_ui/genetic_miner_controller.py:171-180 — second InvalidNodeNameException handler
  • app/graphs/visualization/bpmn_graph.py:339, app/graphs/visualization/petri_net_graph.py:142-146 — node kind guessed from the ID
  • app/graphs/petri_net.py, app/mining_algorithms/fuzzy_mining.py, app/components/interactiveGraph/frontend/src/InteractiveGraph.tsx:53-54

Problem

Graph node IDs are the raw activity names. Several problems follow from this single decision:

  • Colon hack: : has a meaning in DOT edge statements (node:port), so colons are replaced by ___. Activity names that contain ___ are rejected with InvalidNodeNameException, and the user is sent home with an error.
  • Reserved names (Start, End, tau, p_start, gate and silent prefixes) collide with real activities (#7, #19).
  • Escaping must be done correctly in every label builder (#2) and in the injected DOT lines (_get_escaped_node_id).
  • Click handling sends Graphviz IDs back and parses them again (#25).

Corrections from the review

  • The gate and silent checks are substring matches, not prefixes (bpmn_graph.py:339): Investigate, Delegate, Navigate all match.
  • Generated graph IDs do not fix the tau collision. The inductive miners use the string "tau" as the silent marker in the process tree (inductive_mining.py:177,246,250; inductive_mining_infrequent.py:121,174,181,245). The tree needs a sentinel object as well.
  • Fuzzy cluster IDs "Cluster <n>" (fuzzy_mining.py:794) also collide with activities: an activity Cluster 1 raises DuplicateNodeException.
  • The hard-coded {"Start", "End"} in the fuzzy start/end detection (dfg_converter.py:157-183) has to move to node kinds too.
  • For Start/End collisions the user sees "Do not change the parameters while mining" (#8), and the graph stays None.

Root cause of #2, #7, #19, #25.
Related to upstream GitHub issue SWISDATA/processintel#31 Decouple Base Graph and Graphviz Representation.

Fix

  • Every node gets an internal, generated ID (e.g. n17); the activity name is kept only in label / node data
  • HTML labels are built from escaped text in one central place
  • The frontend returns IDs that can be looked up directly
  • The colon substitution and the reserved-name checks are removed

Fixing this resolves #2, #19 and #25, and most of #7 (with the tau sentinel below).

Constraints from the review

  1. IDs must stay the same across re-mining. Fixed layout compares node and edge IDs between separately mined graphs (base_algorithm_controller.py:323-326, :367-370). A per-build counter would make every node look new. Derive IDs from a logical key, e.g. ("activity", name), through a per-graph registry, or match by the logical key.
  2. Happy Path highlighting looks nodes up by activity name (base_graph.py:232-244). It needs a lookup by activity.
  3. Store the node kind (activity, gate, silent, place, start, end, cluster) on Node instead of guessing it from the ID.
  4. Use a tau sentinel in the process tree.
  5. The Petri net toolkit keys places and transitions by plain strings (petri_net.py:46-47,113-118). It needs separate namespaces, or add_petri_net_to_graph must map (kind, id) to graph IDs.
  6. Frontend: return the generated node ID, and for edges an explicit edge ID instead of splitting <title> on ->.
  7. Exports will show generated IDs in DOT/SVG. That changes output users may parse.
  8. Clean-up: remove colon_substitute, substitute_colons*, both InvalidNodeNameException handlers and the colon tests (tests/graphs/visualization/base_graph_test.py:212-250).

The realistic triggers can be fixed first and on their own: HTML escaping (#2) and Start/End collisions (#7).


from issues/ARCH-006-node-identity-equals-display-label.md (code analysis of commit 6bcc646, 2026-10-03), corrected by the review in verdicts-claude/ARCH-006-node-identity-equals-display-label.md

**Severity:** improvement (medium: the triggers can each be fixed with small changes first; the full refactor is large) ## Where - `app/graphs/visualization/base_graph.py` (`add_node`, `substitute_colons`, `get_node`, `get_edge`) - `app/config.py:19-20` - `app/ui/base_algorithm_ui/base_algorithm_controller.py:242-253` - The graph converters in `app/converters/` (not the CSV/XES converters) - `app/ui/genetic_miner_ui/genetic_miner_controller.py:171-180` — second `InvalidNodeNameException` handler - `app/graphs/visualization/bpmn_graph.py:339`, `app/graphs/visualization/petri_net_graph.py:142-146` — node kind guessed from the ID - `app/graphs/petri_net.py`, `app/mining_algorithms/fuzzy_mining.py`, `app/components/interactiveGraph/frontend/src/InteractiveGraph.tsx:53-54` ## Problem Graph node IDs are the raw activity names. Several problems follow from this single decision: - **Colon hack:** `:` has a meaning in DOT edge statements (node:port), so colons are replaced by `___`. Activity names that contain `___` are rejected with `InvalidNodeNameException`, and the user is sent home with an error. - **Reserved names** (`Start`, `End`, `tau`, `p_start`, gate and silent prefixes) collide with real activities (#7, #19). - **Escaping** must be done correctly in every label builder (#2) and in the injected DOT lines (`_get_escaped_node_id`). - **Click handling** sends Graphviz IDs back and parses them again (#25). ### Corrections from the review - The gate and silent checks are substring matches, not prefixes (`bpmn_graph.py:339`): `Investigate`, `Delegate`, `Navigate` all match. - Generated graph IDs do not fix the `tau` collision. The inductive miners use the string `"tau"` as the silent marker in the process tree (`inductive_mining.py:177,246,250`; `inductive_mining_infrequent.py:121,174,181,245`). The tree needs a sentinel object as well. - Fuzzy cluster IDs `"Cluster <n>"` (`fuzzy_mining.py:794`) also collide with activities: an activity `Cluster 1` raises `DuplicateNodeException`. - The hard-coded `{"Start", "End"}` in the fuzzy start/end detection (`dfg_converter.py:157-183`) has to move to node kinds too. - For Start/End collisions the user sees "Do not change the parameters while mining" (#8), and the graph stays `None`. Root cause of #2, #7, #19, #25. Related to upstream GitHub issue [SWISDATA/processintel#31](https://github.com/SWISDATA/processintel/issues/31) *Decouple Base Graph and Graphviz Representation*. ## Fix - Every node gets an internal, generated ID (e.g. `n17`); the activity name is kept only in `label` / node data - HTML labels are built from escaped text in one central place - The frontend returns IDs that can be looked up directly - The colon substitution and the reserved-name checks are removed Fixing this resolves #2, #19 and #25, and most of #7 (with the `tau` sentinel below). ### Constraints from the review 1. **IDs must stay the same across re-mining.** Fixed layout compares node and edge IDs between separately mined graphs (`base_algorithm_controller.py:323-326`, `:367-370`). A per-build counter would make every node look new. Derive IDs from a logical key, e.g. `("activity", name)`, through a per-graph registry, or match by the logical key. 2. **Happy Path highlighting looks nodes up by activity name** (`base_graph.py:232-244`). It needs a lookup by activity. 3. **Store the node kind** (`activity`, `gate`, `silent`, `place`, `start`, `end`, `cluster`) on `Node` instead of guessing it from the ID. 4. **Use a `tau` sentinel in the process tree.** 5. **The Petri net toolkit** keys places and transitions by plain strings (`petri_net.py:46-47,113-118`). It needs separate namespaces, or `add_petri_net_to_graph` must map `(kind, id)` to graph IDs. 6. **Frontend:** return the generated node ID, and for edges an explicit edge ID instead of splitting `<title>` on `->`. 7. **Exports** will show generated IDs in DOT/SVG. That changes output users may parse. 8. **Clean-up:** remove `colon_substitute`, `substitute_colons*`, both `InvalidNodeNameException` handlers and the colon tests (`tests/graphs/visualization/base_graph_test.py:212-250`). The realistic triggers can be fixed first and on their own: HTML escaping (#2) and Start/End collisions (#7). --- from `issues/ARCH-006-node-identity-equals-display-label.md` (code analysis of commit 6bcc646, 2026-10-03), corrected by the review in `verdicts-claude/ARCH-006-node-identity-equals-display-label.md`
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ffrauenberger/ProcessIntel#51
No description provided.