Crate retworkx_core
source · [−]Expand description
retworkx-core
retworkx-core is a graph algorithm crate built on top of petgraph
. It offers
a set of functions that are used in the larger retworkx project but
implemented in a generic manner for use by downstream rust projects.
Usage
First add this crate to your Cargo.toml
:
[dependencies]
retworkx-core = "0.11"
Then in your code, it may be used something like this:
use retworkx_core::petgraph;
use retworkx_core::centrality::betweenness_centrality;
let g = petgraph::graph::UnGraph::<i32, ()>::from_edges(&[
(1, 2), (2, 3), (3, 4), (1, 4)
]);
// Calculate the betweeness 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 retworkx-core are included as part of the retworkx documentation which is hosted at:
https://qiskit.org/documentation/retworkx/release_notes.html
Re-exports
pub use petgraph;
Modules
Module for centrality algorithms
Module for connectivity and cut algorithms.
This module contains the DistanceMap
trait which is used in
shortest_path
.
Module for maximum weight matching algorithmss
Module for shortest path algorithms.
Module for graph traversal algorithms.
Type Definitions
A convenient type alias that by default assumes no error can happen.