yagraphc/lib.rs
1//! # YAGraphC
2//!
3//! Crate for working with Graph data structures and common algorithms on top of it.
4//!
5//! The main focus of this crate is **functionality**. Performance is appreciated but
6//! not the main priority. It is intended to fill the gaps in terms of what is not
7//! currently available in the ecosystem. As an example, it is not easy to find
8//! a graph crate which finds a cycle basis of an undirected graph, while this
9//! is trivial in Python's [networkx](https://networkx.org/).
10//!
11//! ## Example
12//!
13//! ```rust
14//! use yagraphc::prelude::*;
15//! use yagraphc::graph::UnGraph;
16//!
17//! let mut graph = UnGraph::default();
18//!
19//! graph.add_edge(1, 2, 1);
20//! graph.add_edge(2, 3, 3);
21//! graph.add_edge(3, 4, 2);
22//! graph.add_edge(1, 4, 10);
23//!
24//! assert_eq!(graph.dijkstra_with_path(1, 4), Some((vec![1, 2, 3, 4], 6)));
25//! ```
26
27pub mod graph;
28
29pub mod prelude {
30 pub use super::graph::traits::ArithmeticallyWeightedGraph;
31 pub use super::graph::traits::GraphBuilding;
32 pub use super::graph::traits::Traversable;
33}
34
35#[cfg(test)]
36mod tests {
37
38 #[test]
39 fn test_prelude() {
40 use crate::graph::UnGraph;
41 use crate::prelude::*;
42
43 let mut graph = UnGraph::default();
44 graph.add_edge(1, 2, ());
45 }
46}