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
//! BIpartite Graph Sampler.
//!
//! A tool to generate regular bipartite graphs.
//! A bipartite graph is a set of variables and constraints (named like this because of SAT problems)
//! together with a set of edges.
//! Right now, only regular graphs can be sampled.
//! That is, graphs with the same degree for all variables and the same for all constraints.
//!
//! # Quick start
//!
//! Graphs are sampled using a [`Sampler`](crate::Sampler) which are instanciated via
//! the [`builder`](crate::Sampler::builder) method.
//! Then, any random number generator can be used to sample a [`Graph`](crate::graph::Graph).
//!
//! ```
//! use bigs::Sampler;
//! use rand::thread_rng;
//!
//! let sampler = Sampler::builder()
//!     .number_of_variables(10)
//!     .number_of_constraints(6)
//!     .variable_degree(3)
//!     .constraint_degree(5)
//!     .build() // Returns an error if the parameters are invalid.
//!     .unwrap();
//!
//! let graph = sampler.sample_with(&mut thread_rng());
//! let other_graph = sampler.sample_with(&mut thread_rng());
//! ```

pub mod builder;
pub mod error;
pub mod graph;

mod sampler;
pub use crate::sampler::Sampler;

pub use graph::{Edge, Graph};