Graph data structure library. Requires Rust 1.12.
Please read the API documentation here
__
__ https://docs.rs/petgraph/
|buildstatus| |crates|_
.. |buildstatus| image:: https://travis-ci.org/bluss/petgraph.svg?branch=master .. _buildstatus: https://travis-ci.org/bluss/petgraph
.. |crates| image:: http://meritbadge.herokuapp.com/petgraph .. _crates: https://crates.io/crates/petgraph
Crate feature flags:
graphmap
(default) enable GraphMap
.stable_graph
(default) enable StableGraph
.0.4.0
Breaking changes in Graph
:
Graph::edges
and the other edges methods now return an iterator of
edge references
Other breaking changes:
toposort
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.
New features:
New graph traits, for example 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 generalized0.3.2
depth_first_search
, a recursive dfs visitor that emits discovery,
finishing and edge classification events.Filtered
.Debug, NodeIndexable
for Reversed
.0.3.1
.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.0.3.0
Overhaul all graph visitor traits so that they use the IntoIterator
style. This makes them composable.
Multiple graph algorithms use new visitor traits.
Help is welcome to port more algorithms (and create new graph traits in the process)!
GraphMap
can now have directed edges. GraphMap::new
is now generic
in the edge type. DiGraphMap
and UnGraphMap
are new type aliases.
DiGraph, UnGraph, StableDiGraph, StableUnGraph
GraphMap
is based on the ordermap crate. Deterministic iteration
order, faster iteration, no side tables needed to convert to Graph
.DfsPostOrder
Dfs
gained new methods from_parts
and reset
.has_path_connecting
.tarjan_scc
, a second scc implementation.Dfs, DfsPostOrder, scc, tarjan_scc
.has_path_connecting
,
is_cyclic_directed, toposort
.Debug
formatting for Graph, StableGraph
.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.StableGraph
by defaultGraph::contains_edge
.EdgeDirection
→ Direction
.SubTopo
.0.2.9
0.2.8
0.2.7
0.2.6
0.2.5
0.2.4
0.2.3
0.2.2
Dot
passes on the alternate flag to node and edge label formattingClone
impl for some iteratorsGraph::neighbors
StableGraph
, using feature flag stable_graph
0.2.1
is_isomorphic_matching
0.2.0
New Features
Add Graph::neighbors().detach() to step edges without borrowing. This is more general than, and replaces now deprecated walkedgesdirected. (#39)
Add method EdgeDirection::opposite()
Breaking changes
Graph::neighbors() for undirected graphs and Graph::neighbors_undirected for any graph now visit self loop edges once, not twice. (#31)
Option<E>
Element type of GraphMap<N, E>::all_edges()
changed to (N, N, &E)
Minor breaking changes
IntoWeightedEdge changed a type parameter to associated type
0.1.18
0.1.17
quickcheck::Arbitrary
implementations,
if optional feature quickcheck
is enabled.0.1.16
0.1.15
0.1.14
0.1.13
0.1.12
0.1.11
0.1.10
0.1.9
0.1.8
0.1.7
0.1.6
0.1.4
Dual-licensed to be compatible with the Rust project.
Licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0 or the MIT license http://opensource.org/licenses/MIT, at your option. This file may not be copied, modified, or distributed except according to those terms.