Skip to content

Version Packages - #41

Merged
davidkpiano merged 1 commit into
mainfrom
changeset-release/main
Oct 3, 2026
Merged

davidkpiano merged 1 commit into
mainfrom
changeset-release/main

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@statelyai/graph@2.5.0

Minor Changes

  • #43 e87acee Thanks @davidkpiano! - Tighten algorithm contracts:

    • Breaking: getMinCut takes { from, to } (was { source, sink }) and returns cutEdges as edge objects, matching getMaxFlow.
    • Breaking: unknown node ids are "not found" instead of errors or fabricated results. getMaxFlow, getMinCut, and getSteinerTree return undefined (getSteinerTree also when the terminals are disconnected), getDominatorTree returns {}, hasPath(g, x, x) is false for an unknown x, and path queries no longer yield a trivial self-path for an unknown source.
    • Breaking: getDegree counts every self-loop twice, including non-directed ones, so degrees sum to 2 × edges.length.
    • hasPath accepts { direction } and runs on the CSR snapshot.
    • isAcyclic is iterative, so deep graphs no longer overflow the call stack, runs in O(n + m) for graphs mixing directed and non-directed edges (previously exponential in the worst case), and is cached until the graph changes.
    • genCycles is now lazy: Johnson's algorithm per biconnected block, iterative, O((n + m) · (cycles + 1)). Taking the first cycle of a dense graph no longer enumerates all of them first, and long cycles no longer overflow the call stack. Cycle order may differ.
    • New getCycle returns one cycle (or undefined) in O(n + m).
    • Breaking: isTree returns false for the empty graph. It ignores edge direction (a → c ← b is a tree).
    • New isArborescence checks for a rooted tree whose edges all point away from the root, optionally at { from }.
    • New genTopologicalSort; both topological sorts accept { from } to emit chosen nodes first.
    • Lazy generators (genShortestPaths, genSimplePaths, genCycles, genAllPairsShortestPaths, genShortestSimplePaths, genPreorders, genPostorders, genGirvanNewmanCommunities) no longer return wrong results or crash when the graph is mutated mid-iteration.
    • Breaking: getDepth returns undefined (was -1) for an unknown node, and isLeaf/isCompound return false for one.
    • isIsomorphic is a VF2-style matcher: breadth-first matching order, candidates from neighbors of matched nodes, O(degree) checks, iterative. Large sparse graphs that previously never finished now take milliseconds. It also no longer pairs a directed self-loop with a non-directed one, and pairs parallel edges exactly under edgeMatch instead of greedily.
    • No more call-stack overflows on deep inputs: genSimplePaths/getSimplePath, tied shortest-path reconstruction (genShortestPaths, Floyd–Warshall), getDescendants, deleteNode cascades, getFlattenedGraph, getTransitiveReduction, and maximum bipartite matching are iterative.
    • genPreorders/genPostorders backtrack with an undo log instead of copying state per step (a chain no longer costs O(n²)), and no longer drop orders that end at a dangling edge. getPreorder no longer rescans neighbors when returning to a node.
    • getTransitiveReduction no longer crashes on an edge from a missing node.
    • Fix a memory leak: the graph index no longer keeps a WeakRef memo, which kept every graph indexed during one synchronous call alive until it returned (e.g. ~2.8 GB for getShortestSimplePaths on a 3,000-node chain, now ~200 MB).
    • getModularity runs in O(n + m) (was quadratic in community size), ignores dangling edges, and tolerates unknown ids in communities.
    • getFlattenedGraph runs in linear time on deep hierarchies (was quadratic) by resolving leaf ranges and initial states once.
    • getMaxFlow/getMinCut and getGreedyModularityCommunities no longer crash on dangling edges; random walks no longer step onto them.
    • Breaking: getTSPTour returns undefined for an unknown from (previously started at the first node); genPredefinedWalk yields nothing from an unknown start; getCoverage no longer counts an unknown start node as visited.
  • #39 047e583 Thanks @davidkpiano! - Add @statelyai/graph/xstate with createGraphFromMachine(machine, options?): one machine→graph path that enumerates events from the machine's own descriptors, serializes nodes as { value, context } (same ids as xstate/graph), and attaches guard text (hypothesized: true), actions, and selected transition definitions to edges. getCoverageTargets on the result yields stable state / transition / transition-pair targets. xstate v5 is an optional peer dependency.

Patch Changes

  • #40 898a277 Thanks @davidkpiano! - Preserve quoted Mermaid state stereotypes and flowchart labels while expanding compact links and semicolon-separated statements correctly.

  • #42 db0f3e5 Thanks @davidkpiano! - Export FlowchartClick from the Mermaid subpath and document literal Mermaid data fields.

@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: f248e673-61b5-48f5-89f0-48f80cc1ce0c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@github-actions
github-actions Bot force-pushed the changeset-release/main branch 2 times, most recently from d9e27c7 to 3a65c5f Compare October 1, 2026 17:32
@github-actions
github-actions Bot force-pushed the changeset-release/main branch from 3a65c5f to 9acbf12 Compare October 1, 2026 20:06
@davidkpiano
davidkpiano merged commit d0c422c into main Oct 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant