Skip to content

FE-1509: Add the structural analyses β€” cycles and initial places - #9431

Draft
kube wants to merge 1 commit into
claude/fe-1509-notebook-explorerfrom
claude/fe-1509-notebook-analyses-algorithms
Draft

FE-1509: Add the structural analyses β€” cycles and initial places#9431
kube wants to merge 1 commit into
claude/fe-1509-notebook-explorerfrom
claude/fe-1509-notebook-analyses-algorithms

Conversation

@kube

@kube kube commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

🌟 What is the purpose of this PR?

The notebook's structural analyses as pure algorithms, stacked on #9408: cycle detection and initial-place (siphon) analysis over the net's arc structure. Nothing consumes them yet β€” the UI layer above surfaces both β€” so this PR reviews as two algorithms and their test suites.

πŸ”— Related links

πŸ” What does this change?

  • net-cycles: cycles as iterative Tarjan strongly connected components, sized above one, labelled in document order. SCCs rather than elementary cycles because their count can be exponential and the reader's question is "these nodes feed back into each other".
  • net-siphons: "which places must the initial marking cover" as minimal siphons β€” place sets nothing in the net can seed, unifying plain source places with resource pools that only circulate what they start with. Found per place by a polynomial greedy shrink from the maximal siphon; groups merely containing or overlapping a reported group are dropped for readability; transitions referencing deleted places are excluded because they can never fire; nets above 100 places skip the analysis rather than stall a render.
  • An authored arch-docs deep-dive (notebook/graph-analyses) recording why each algorithm was chosen, linked from the notebook layer's README.

Pre-Merge Checklist πŸš€

🚒 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing
    • one patch changeset for the whole stack ships in the top PR

πŸ“œ Does this require a change to the docs?

The changes in this PR:

  • are in a state where docs changes are not yet required but will be
    • this is tracked in: the user-docs PR at the top of this stack

πŸ•ΈοΈ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

πŸ›‘ What tests cover this?

  • net-cycles.test.ts: SCC detection, document-order labelling, membership maps.
  • net-siphons.test.ts: source places, circulating pools, source transitions, contained-group filtering, stale-arc handling, and the shipped example nets (production machines, satellites, SIR).

❓ How to test this?

  1. npx turbo run test:unit --filter @hashintel/petrinaut
  2. Read the deep-dive: libs/@local/petrinaut-arch-docs/content/notebook/graph-analyses.mdx.

@kube kube self-assigned this Aug 29, 2026
@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview Aug 29, 2026 2:18pm
petrinaut Ready Ready Preview Aug 29, 2026 2:18pm
petrinaut-docs Ready Ready Preview Aug 29, 2026 2:18pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Aug 29, 2026 2:18pm

Request Review

Two pure, unit-tested analyses over the net's arc structure:

- Cycle detection as iterative Tarjan strongly connected components,
  sized above one, labelled in document order.
- Initial-place analysis as minimal siphons β€” the place sets nothing
  in the net can seed, unifying plain source places with resource
  pools that only circulate what they start with. Found by a
  polynomial greedy shrink; transitions referencing deleted places are
  excluded because they can never fire; capped at 100 places.

Nothing consumes them yet; the layer above surfaces both in the cell
list and the graph explorer. An authored arch-docs deep-dive records
why each algorithm was chosen.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

1 participant