Crate rustworkx_core
source ·Expand description
rustworkx-core
rustworkx-core is a graph algorithm crate built on top of petgraph
. It offers
a set of functions that are used in the larger rustworkx project but
implemented in a generic manner for use by downstream rust projects.
Usage
First add this crate to your Cargo.toml
:
[dependencies]
rustworkx-core = "0.11"
Then in your code, it may be used something like this:
use rustworkx_core::petgraph;
use rustworkx_core::centrality::betweenness_centrality;
let g = petgraph::graph::UnGraph::<i32, ()>::from_edges(&[
(1, 2), (2, 3), (3, 4), (1, 4)
]);
// Calculate the betweenness centrality
let output = betweenness_centrality(&g, false, false, 200);
assert_eq!(
vec![Some(0.0), Some(0.5), Some(0.5), Some(0.5), Some(0.5)],
output
);
Algorithm Modules
The crate is organized into
Release Notes
The release notes for rustworkx-core are included as part of the rustworkx documentation which is hosted at:
Re-exports
pub use petgraph;
Modules
- Module for centrality algorithms.
- Module for coloring algorithms.
- Module for connectivity and cut algorithms.
- This module contains the
DistanceMap
trait which is used inshortest_path
. - This module contains generator functions for building graphs
- Module for maximum weight matching algorithms.
- Module for planar graphs.
- Module for shortest path algorithms.
- Module for swapping tokens
- Module for graph traversal algorithms.
Type Definitions
- A convenient type alias that by default assumes no error can happen.