# petgraph/petgraph

Graph data structure library for Rust.

Repository: https://github.com/petgraph/petgraph
Canonical: https://ross.abutalabs.com/products/petgraph
Homepage: https://docs.rs/petgraph/
Language: Rust
License: Apache-2.0
License Family: permissive
Topics: rust, graph-algorithms
Last push: 2026-08-23T17:22:55+00:00

## Health v2 (maintenance only)
Score: 78/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 99, release rhythm 38, longevity 100
- inputs: {"age_days": 4272, "days_push": 10, "days_rel": 337, "gap_med": 60, "n_releases_24m": 4}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 4004, forks 460 (observed 2026-08-28T04:08:32.121313+00:00)

## What it is
Petgraph is a Rust library providing fast, flexible graph data structures (Graph, StableGraph, GraphMap, MatrixGraph) with directed and undirected edges and arbitrary node/edge data. It includes algorithms such as Dijkstra's shortest path, minimum spanning trees, and graph isomorphism, plus Graphviz DOT import/export.

## Use cases
- find shortest paths in a graph in Rust
- compute minimum spanning trees
- check graph isomorphism
- represent directed and undirected graphs with node and edge data
- export graphs to Graphviz DOT format
- implement custom graph algorithms via traits
- run union-find on graph nodes

## When to choose
- you need general-purpose graph data structures and algorithms in Rust
- you want multiple graph representations with different performance tradeoffs
- you need to visualize graphs via Graphviz DOT
- you want a mature, widely used, permissively licensed Rust crate

## When to avoid
- you need distributed or out-of-core graph processing on massive graphs
- you need dynamic graph visualization or interactive rendering (use a visualization tool instead)
- you need a graph database with persistence and queries
- you are not working in Rust

## Facets
- artifact type: library
- maturity: stable
- function: developer-tools, data-science, graphics
- domain: data-science, developer-tools
- platform: rust, cross-platform
- tags: graph-data-structures, graph-algorithms, shortest-path, minimum-spanning-tree, graphviz-dot, directed-graphs, undirected-graphs, data-structure, algorithms

## Member repositories
- petgraph/petgraph (main) score 78

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:32.121313+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:24:05.940259+00:00, confidence not recorded.
  - readme: https://github.com/petgraph/petgraph (fetched 2026-08-28T04:08:32.121313+00:00, sha e120337dd713)
  - homepage: https://docs.rs/petgraph/ (fetched 2026-08-29T09:17:12.311372+00:00, sha 13120e6c4ca1)
  - site_page: https://docs.rs/ (fetched 2026-08-29T09:17:12.314812+00:00, sha 35213d539031)
  - site_page: https://docs.rs/crate/petgraph/latest (fetched 2026-08-29T09:17:12.316903+00:00, sha e77b2653df19)
  - site_page: https://docs.rs/crate/petgraph/latest/features (fetched 2026-08-29T09:17:12.318851+00:00, sha 1e9aa969e4d0)
  - site_page: https://docs.rs/about (fetched 2026-08-29T09:17:12.320548+00:00, sha 29ab7986fbf5)
  - site_page: https://docs.rs/about/badges (fetched 2026-08-29T09:17:12.322097+00:00, sha 6588cac258af)
  - site_page: https://docs.rs/about/builds (fetched 2026-08-29T09:17:12.323854+00:00, sha 811231ca4680)
  - site_page: https://docs.rs/about/metadata (fetched 2026-08-29T09:17:12.325609+00:00, sha 0dcdccb2b2b2)
  - site_page: https://docs.rs/about/redirections (fetched 2026-08-29T09:17:12.327444+00:00, sha 1b1efd93105f)
- Data as of 2026-08-30T08:39:29.467469+00:00.
