domino_lib/graph_models/generate_sequence/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::graph_models::graph_types::{graph::GraphTrait, regular_graph::RegularGraph};
use hierholzer::hierholzer;
use sequence::as_sequence;

mod hierholzer;
pub mod sequence;

pub fn generate_solution(n: usize, random: bool) -> Vec<(String, String)> {
    let mut reg_graph = RegularGraph::new(n);
    let pog_graph = hierholzer(&mut reg_graph, random);
    let sequence = as_sequence(&pog_graph.adjacency(), random);
    sequence.into_iter().map(|tile| tile.unwrap()).collect()
}