# @xstate/graph

> XState graph utilities

Latest version **3.0.4** (published 2025-05-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install @xstate/graph
pnpm add @xstate/graph
yarn add @xstate/graph
bun add @xstate/graph
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score; popular repo.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 3.0.4 |
| Published | 2025-05-31 |
| First published | 2019-02-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 76 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 30135 |
| Author | David Khourshid |
| Maintainers | davidkpiano, andarist, xstate-release-bot |
| Keywords | state, machine, statechart, scxml, state, graph |

## Links

- npm: https://www.npmjs.com/package/@xstate/graph
- Repository: https://github.com/statelyai/xstate
- Homepage: https://github.com/statelyai/xstate/tree/main/packages/xstate-graph#readme
- Issues: https://github.com/statelyai/xstate/issues
- npm.io page: https://npm.io/package/@xstate/graph

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 3.0.4 (latest) — 2025-05-31
- 2.0.0-beta.6 (beta) — 2024-01-11
- 2.0.0-alpha.2 (alpha) — 2023-05-03
- 1.0.0-rc1.1 (next) — 2019-08-22
- 3.0.3 — 2025-05-12
- 3.0.2 — 2025-01-12
- 3.0.1 — 2024-12-24
- 3.0.0 — 2024-11-12
- 2.0.1 — 2024-09-21
- 2.0.0 — 2024-05-29
- 2.0.0-beta.5 — 2023-09-24
- 2.0.0-beta.4 — 2023-09-06
- 2.0.0-beta.3 — 2023-09-05
- 2.0.0-alpha.1 — 2023-03-07
- 2.0.0-alpha.0 — 2022-05-30
- … 13 more at https://npm.io/package/@xstate/graph/versions

## README

# @xstate/graph

This package contains graph algorithms and utilities for XState machines.

- [Read the full documentation in the XState docs](https://xstate.js.org/docs/packages/xstate-graph/).
- [Read our contribution guidelines](https://github.com/statelyai/xstate/blob/main/CONTRIBUTING.md).

## Quick start

1. Install `xstate` and `@xstate/graph`:

```bash
npm install xstate @xstate/graph
```

2. Import the graph utilities. Example:

```js
import { createMachine } from 'xstate';
import { getSimplePaths } from '@xstate/graph';

const machine = createMachine(/* ... */);
const paths = getSimplePaths(machine);
```

---
_Source: https://npm.io/package/@xstate/graph · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
