NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #250 most downloaded on crates.io
Graph data structure library. Provides graph types and graph algorithms.
Last release 1 years ago
30 Sep 2025
Ships fairly regularly
a new release about every 6 months
Nearly every release is documented
notes for 56 of the last 60 stable releases
1 version withdrawn
withdrawn after publishing
12 years old
78 releases · first in 2015
Infinite subgraph_isomorphisms_iter for empty isomorphisms
subgraph_isomorphisms_iter for empty isomorphisms (#780)UndirectedAdaptor (#870) (#871)StableGraph::reverse breaks free lists (#890)GraphMap link in README (#857)Dot::with_attr_getters (#850)into_nodes_edges_iters to StableGraph (#841)StableGraph capacity (#846)map_owned and filter_map_owned for Graph and StableGraph (#863)One column per quarter.
This minor release fixes several bugs, adds two new algorithms, slightly improves the performance of maximum_matching , adds a tool for parsing graphs
This minor release fixes several bugs, adds two new algorithms, slightly improves the performance of maximum_matching,
adds a tool for parsing graphs from Dot/Graphviz files, and improves the documentation, making it more complete and uniform, as well as clarifying several points.
StableGraph::edge_indices behaviour (#812)DataMap for GraphMap graphs (#776)maximum_matching main loop (#817)This patch release re-adds a missing VisitMap implementation that was dropped in the 0.8.0 release, improves error messaging in panicking functions, a
This patch release re-adds a missing VisitMap implementation that was dropped in the 0.8.0 release,
improves error messaging in panicking functions, and adds capacity management methods to UnionFind.
VisitMap impl for std HashSet (#764)Add VisitMap::unvisit as proposed in #610
no_std Support (#747)VisitMap::unvisit as proposed in #610 (#611)dot::Config non_exhaustive (#756)from_f32/64 methods for Float, Unit, and Bounded measures (#733)UnionFind::new_set (#684)Csr::try_add_edge (#719)UnionFind methods (#730)MatrixGraph methods with recoverable errors (#720)Graph and StableGraph (#718)Release 0.7.1
Release 0.7.0
Release 0.7.0 (#713)
Release 0.6.6
Release 0.6.6 (#706)
UndirectedAdaptor (#695)LowerHex and UpperHex implementations for Dot (#687)serde support more complete (#550)fixedbitset to 0.5.7 (#664)immediately_dominated_by function called on root of graph returns root itself (#670)Csr and List (#648)all_simple_paths function documentation (#693)Release 0.6.5
Release 0.6.5 (#644)
GraphMap (#573, #615)Topo::with_initials method (#585)itertools to 0.12.1 (#628)GraphMap to allow custom hash functions (#622)copyclone macro (#601)Release 0.6.4
Release 0.6.4 (#579)
Added an iterator over subgraph isomorphisms
GraphMap (#496)reverse method for StableGraph (#533)edges_connecting iterator for StableGraph (#521)487_)476_)472_)MatrixGraph (#505)Loosed the strict version dependency set in 493_, to allow users to use newer versions of indexmap (495_).
493, to allow users to use newer versions of indexmap (495).Added clarifications on Graph docs (491_).
491_).493_).Removed the NodeCompactIndexable trait impl for MatrixGraph (#429).
NodeCompactIndexable trait impl for MatrixGraph (#429).IntoEdges::edges implementations are now required return edges with the passed node as source (#433).immediately_dominated_by method to the dominators result (#337).adj::List, a new append-only graph type using a simple adjacency list with no node-weights (#263).dag_to_toposorted_adjacency_list and dag_transitive_reduction_closure algorithms to transitively reduce an acyclic graph (#263).is_isomorphic algorithm generic on both graph types (#369).node_weights and edge_weights methods for Graph and StableGraph (#363).find_negative_cycle algorithm (#434).tarjan_scc (#313)tarjan_scc (#413).petgraph::dot a bit (#424).StableGraph::extend_with_edges (#415).GraphMap::remove_node not removing some edges (#432).Implement Default for traversals.
Default for traversals.EdgesConnecting publicly.is_bipartite_graph.FilterNode implementation for FixedBitSet and HashSet.node_weights_mut and edge_weights_mut for StableGraph.The iterative DFS implementation, Dfs, now marks nodes visited when they are pushed onto the stack, not when they're popped off. This may require chan
Dfs, now marks nodes visited when
they are pushed onto the stack, not when they're popped off. This may
require changes to callers that use Dfs::from_parts or manipulate
its internals.IntoEdgesDirected trait now has a stricter contract for
undirected graphs. Custom implementations of this trait may have to be
updated. See the trait documentation__ for more.MatrixGraph implementation__ https://docs.rs/petgraph/0.5/petgraph/visit/trait.IntoEdgesDirected.html
Fix clippy warnings by @jonasbb
Csr by @ksadorffind_map in new RustNewtype Time now also implements Hash
Time now also implements HashFrozen.Fix petgraph::NodeReferences to be publicly visible
petgraph::graph::NodeReferences to be publicly visibleAdd graph trait IntoEdgesDirected
IntoEdgesDirectedFix bellman_ford to work correctly with undirected graphs (#152) by @carrutstick
bellman_ford to work correctly with undirected graphs (#152) by
@carrutstickGraph, Stablegraph's .map().StableGraph learned new methods nearing parity with Graph. Note that the StableGraph methods preserve index stability even in the batch removal method
StableGraph learned new methods nearing parity with Graph. Note
that the StableGraph methods preserve index stability even in the batch
removal methods like filter_map and retain_edges.
.filter_map(), which maps associated node and edge data.retain_edges(), .edge_indices() and .clear_edges()Existing Graph iterators gained some trait impls:
.node_indices(), .edge_indices() are ExactSizeIterator.node_references() is now
DoubleEndedIterator + ExactSizeIterator..edge_references() is now ExactSizeIterator.Implemented From<StableGraph> for Graph.
New algorithm by @jmcomets: A* search algorithm in petgraph::astar
petgraph::algo::astarStableGraph bug fix whose patch was supposed to be in the previous
version:
add_edge(m, n, _) now properly always panics if nodes m or n don't
exist in the graph.New optional crate feature: "serde-1", which enables serialization for Graph and StableGraph using serde.
New optional crate feature: "serde-1", which enables serialization
for Graph and StableGraph using serde.
Add methods new, add_node to Csr by @jmcomets
Add indexing with [] by node index, NodeCompactIndexable for
Csr by @jmcomets
Amend doc for GraphMap::into_graph (it has a case where it can panic)
Add implementation of From<Graph> for StableGraph.
Add implementation of IntoNodeReferences for &StableGraph.
Add method StableGraph::map that maps associated data
Add method StableGraph::find_edge_undirected
Many StableGraph bug fixes involving node vacancies (holes left by
deletions):
neighbors(n) and similar neighbor and edge iterator methods now
handle n being a vacancy properly. (This produces an empty iterator.)find_edge(m, n) now handles m being a vacancy correctly tooStableGraph::node_bound was fixed for empty graphs and returns 0Add implementation of DoubleEndedIterator to Graph, StableGraph's
edge references iterators.
Debug output for Graph now shows node and edge count. Graph, StableGraph
show nothing for the edges list if it's empty (no label).
Arbitrary implementation for StableGraph now can produce graphs with
vacancies (used by quickcheck)
Fix max ambiguity error with current rust nightly by @daboross
max ambiguity error with current rust nightly by @daboross (#153)Add GraphMap::all_edges_mut() iterator by @Binero
GraphMap::all_edges_mut() iterator by @BineroStableGraph::retain_nodes by @RupsbantStableGraph::index_twice_mut by @christolliday- Add crate categories
Move the visit.rs file due to changed rules for a module’s directory ownership in Rust, resolving a future compat warning.
visit.rs file due to changed rules for a module’s directory
ownership in Rust, resolving a future compat warning.Cycle, NegativeCycle now implement PartialEq.Add new algorithm simple_fast for computing dominators in a control-flow graph.
simple_fast for computing dominators in a control-flow
graph.Graph::edges and the other edges methods now return an iterator of edge references
GraphGraph::edges and the other edges methods now return an iterator of
edge referencestoposort now returns an error if the graph had a cycle.is_cyclic_directed no longer takes a dfs space argument. It is
now recursive.scc was renamed to kosaraju_scc.min_spanning_tree now returns an iterator that needs to be
made into a specific graph type deliberately.dijkstra now uses the IntoEdges trait.NodeIndexable changed its method signatures.IntoExternals was removed, and many other smaller adjustments
in graph traits. NodeId must now implement PartialEq, for example.DfsIter, BfsIter were removed in favour of a more general approach
with the Walker trait and its iterator conversion.IntoEdges which returns
an iterator of edge references. Everything implements the graph traits
much more consistently.DataMap,
Build, Create, FromElements.EdgeFiltered. Filtered was renamed to NodeFiltered.Csr).GraphMap implements NodeIndexable.Dot was generalizedAdd depth_first_search, a recursive dfs visitor that emits discovery, finishing and edge classification events.
depth_first_search, a recursive dfs visitor that emits discovery,
finishing and edge classification events.
Filtered.Debug, NodeIndexable for Reversed.Add .edges(), .edges_directed() to StableGraph. Note that these differ from Graph, because this is the signature they will all use in the future.
.edges(), .edges_directed() to StableGraph. Note that these
differ from Graph, because this is the signature they will all use
in the future..update_edge() to StableGraph.stable_graph module (for example
NodeIndex).visit module.Overhaul all graph visitor traits so that they use the IntoIterator style. This makes them composable.
Overhaul all graph visitor traits so that they use the IntoIterator
style. This makes them composable.
GraphMap can now have directed edges. GraphMap::new is now generic
in the edge type. DiGraphMap and UnGraphMap are new type aliases.
Add type aliases DiGraph, UnGraph, StableDiGraph, StableUnGraph
GraphMap is based on the indexmap crate. Deterministic iteration
order, faster iteration, no side tables needed to convert to Graph.
Improved docs for a lot of types and functions.
Add graph visitor DfsPostOrder
Dfs gained new methods from_parts and reset.
New algo has_path_connecting.
New algo tarjan_scc, a second scc implementation.
Document traversal order in Dfs, DfsPostOrder, scc, tarjan_scc.
Optional graph visitor workspace reuse in has_path_connecting,
is_cyclic_directed, toposort.
Improved Debug formatting for Graph, StableGraph.
Add a prelude module
GraphMap now has a method .into_graph() that makes a Graph.
Graph::retain_nodes, retain_edges now expose the self graph only
as wrapped in Frozen, so that weights can be mutated but the
graph structure not.
Enable StableGraph by default
Add method Graph::contains_edge.
Renamed EdgeDirection → Direction.
Remove SubTopo.
Require Rust 1.12 or later
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Fix compilation with rust nightly
- Fix a bug in SubTopo
Add Graph methods reserve_nodes, reserve_edges, reserve_exact_nodes, reserve_exact_edges, shrink_to_fit_edges, shrink_to_fit_nodes, shrink_to_fit
- Update URLs
Fix warning about type parameter defaults (no functional change)
Add SubTopo, a topo walker for the subgraph reachable from a starting point.
Fix an algorithm error in scc (#61). This time we have a test that crosschecks the result of the algorithm vs another implementation, for greater conf
Require Rust 1.6: Due to changes in how rust uses type parameter defaults.
Dot passes on the alternate flag to node and edge label formatting
Dot passes on the alternate flag to node and edge label formattingClone impl for some iteratorsGraph::neighborsStableGraph, using feature flag stable_graphAdd algorithm is_isomorphic_matching
is_isomorphic_matchingAdd Graph::neighbors().detach() to step edges without borrowing. This is more general than, and replaces now deprecated walk_edges_directed.
Option<E>GraphMap<N, E>::all_edges() changed to (N, N, &E)Fix bug on calling GraphMap::add_edge with existing edge
Add Graph::capacity(), GraphMap::capacity()
quickcheck::Arbitrary implementations,
if optional feature check is enabled.Add Graph::node_indices(), Graph::edge_indices()
Add Graph::map() and Graph::filter_map()
Add new topological order visitor Topo
Add iterator GraphMap::all_edges
- Fix an algorithm error in scc
Update for well-formedness warnings (Rust RFC 1214), adding new lifetime bounds on NeighborIter and Dfs, impact should be minimal.
Fix bug in WalkEdges::next_neighbor()
Fix Dfs/Bfs for a rustc bugfix that disallowed them
Add Graph::walk_edges_directed()
- Add Graph::edges_directed()
Add Graph::node_weights_mut and Graph::edge_weights_mut
Your coding agent can read these notes before it upgrades. Set up the MCP server →