1use graph_solver::*;
2
3const RED: Color = 2;
4const GREEN: Color = 3;
5const GREEN_DASHED: Color = 4;
6
7fn main() {
8 let mut g = Graph::new();
9 let a = Node {
10 color: 0,
11 self_connected: false,
12 edges: vec![
13 Constraint {edge: RED, node: 1},
14 Constraint {edge: GREEN, node: 1},
15 ]
16 };
17 let b = Node {
18 color: 1,
19 self_connected: false,
20 edges: vec![
21 Constraint {edge: RED, node: 0},
22 Constraint {edge: GREEN_DASHED, node: 0},
23 ]
24 };
25 let c = Node {
26 color: 0,
27 self_connected: false,
28 edges: vec![
29 Constraint {edge: RED, node: 1},
30 Constraint {edge: GREEN_DASHED, node: 1},
31 ]
32 };
33 let d = Node {
34 color: 1,
35 self_connected: false,
36 edges: vec![
37 Constraint {edge: RED, node: 0},
38 Constraint {edge: GREEN, node: 0},
39 ]
40 };
41 g.push(a);
42 g.push(b);
43 g.push(c);
44 g.push(d);
45
46 let solve_settings = SolveSettings::new();
47 if let Some(solution) = g.solve(solve_settings) {
48 let nodes = &["black", "white"];
50 let edges = &["red", "green", "green,style=dashed"];
51 println!("{}", solution.puzzle.graphviz("sfdp", nodes, edges));
52 }
53}