rustworkx_core/generators/
mod.rs

1// Licensed under the Apache License, Version 2.0 (the "License"); you may
2// not use this file except in compliance with the License. You may obtain
3// a copy of the License at
4//
5//     http://www.apache.org/licenses/LICENSE-2.0
6//
7// Unless required by applicable law or agreed to in writing, software
8// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10// License for the specific language governing permissions and limitations
11// under the License.
12
13//! This module contains generator functions for building graphs
14
15mod barbell_graph;
16mod binomial_tree_graph;
17mod complete_graph;
18mod cycle_graph;
19mod dorogovtsev_goltsev_mendes_graph;
20mod full_rary_tree_graph;
21mod grid_graph;
22mod heavy_hex_graph;
23mod heavy_square_graph;
24mod hexagonal_lattice_graph;
25mod karate_club;
26mod lollipop_graph;
27mod path_graph;
28mod petersen_graph;
29mod random_graph;
30mod star_graph;
31
32mod utils;
33
34use std::{error::Error, fmt};
35
36/// Error returned by generator functions when the input arguments are an
37/// invalid combination (such as missing required options).
38#[derive(Debug, PartialEq, Eq)]
39pub struct InvalidInputError;
40
41impl Error for InvalidInputError {}
42
43impl fmt::Display for InvalidInputError {
44    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
45        write!(f, "Invalid inputs received.")
46    }
47}
48
49pub use barbell_graph::barbell_graph;
50pub use binomial_tree_graph::binomial_tree_graph;
51pub use complete_graph::complete_graph;
52pub use cycle_graph::cycle_graph;
53pub use dorogovtsev_goltsev_mendes_graph::dorogovtsev_goltsev_mendes_graph;
54pub use full_rary_tree_graph::full_rary_tree_graph;
55pub use grid_graph::grid_graph;
56pub use heavy_hex_graph::heavy_hex_graph;
57pub use heavy_square_graph::heavy_square_graph;
58pub use hexagonal_lattice_graph::{hexagonal_lattice_graph, hexagonal_lattice_graph_weighted};
59pub use karate_club::karate_club_graph;
60pub use lollipop_graph::lollipop_graph;
61pub use path_graph::path_graph;
62pub use petersen_graph::petersen_graph;
63pub use random_graph::barabasi_albert_graph;
64pub use random_graph::gnm_random_graph;
65pub use random_graph::gnp_random_graph;
66pub use random_graph::hyperbolic_random_graph;
67pub use random_graph::random_bipartite_graph;
68pub use random_graph::random_geometric_graph;
69pub use random_graph::sbm_random_graph;
70pub use star_graph::star_graph;