1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
//! # 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`:
//!
//! ```toml
//! [dependencies]
//! rustworkx-core = "0.11"
//! ```
//!
//! Then in your code, it may be used something like this:
//!
//! ```rust
//! 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
//!
//! * [`centrality`](./centrality/index.html)
//! * [`connectivity`](./connectivity/index.html)
//! * [`max_weight_matching`](./max_weight_matching/index.html)
//! * [`shortest_path`](./shortest_path/index.html)
//! * [`token_swapper`](./token_swapper/index.html)
//! * [`traversal`](./traversal/index.html)
//! * [`generators`](./generators/index.html)
//!
//! ## 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>
use std::convert::Infallible;
/// A convenient type alias that by default assumes no error can happen.
///
/// It can be used to avoid type annotations when the function you want
/// to use needs a callback that returns [`Result`] but in your case no
/// error can happen.
pub type Result<T, E = Infallible> = core::result::Result<T, E>;
/// Module for centrality algorithms.
pub mod centrality;
/// Module for coloring algorithms.
pub mod coloring;
pub mod connectivity;
pub mod generators;
/// Module for maximum weight matching algorithms.
pub mod max_weight_matching;
pub mod planar;
pub mod shortest_path;
pub mod traversal;
// These modules define additional data structures
pub mod dictmap;
pub mod distancemap;
mod min_scored;
/// Module for swapping tokens
pub mod token_swapper;
pub mod utils;
// re-export petgraph so there is a consistent version available to users and
// then only need to require rustworkx-core in their dependencies
pub use petgraph;