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:

https://qiskit.org/ecosystem/rustworkx/release_notes.html

Re-exports

Modules

Type Definitions

  • A convenient type alias that by default assumes no error can happen.