hexagon/
hexagon.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![
14            Constraint {edge: EDGE, node: 0},
15            Constraint {edge: EDGE, node: 0},
16        ]
17    };
18
19    for _ in 0..6 {g.push(a.clone())}
20    g.push_pair((2, 3));
21
22    let solve_settings = SolveSettings::new();
23    if let Some(solution) = g.solve(solve_settings) {
24        // solution.puzzle.print();
25        println!("{}", solution.puzzle.graphviz(
26            "sfdp",
27            &["black,fontcolor=white"],
28            &["black"]
29        ));
30    }
31}