4cube/
4cube.rs

1use graph_solver::*;
2
3// Notice that edges starts with `2`.
4const EDGE: Color = 2;
5
6fn main() {
7    let mut g = Graph::new();
8
9    // Create a node pattern.
10    let a = Node {
11        color: 0,
12        self_connected: false,
13        edges: vec![Constraint {edge: EDGE, node: 0}; 4]
14    };
15
16    for _ in 0..16 {g.push(a.clone())}
17    g.no_triangles = true;
18    g.connected = true;
19
20    let solve_settings = SolveSettings::new(); // .debug(true).sleep_ms(10);
21    if let Some(solution) = g.solve(solve_settings) {
22        // solution.puzzle.print();
23        println!("{}", solution.puzzle.graphviz(
24            "sfdp",
25            &["black,fontcolor=white"],
26            &["black"]
27        ));
28    } else {
29        eprintln!("<no solution>");
30    }
31}