Utility crate to handle common tasks that require graphs
```rs use comtesse::{unweighted::Unweighted, HasEdge};
let mut graph = Unweighted::new(); // insert the numbers 1 to 10 as vertices for i in 1..=10 { graph.addvertex(i); } asserteq!(graph.size(), 10);
// construct a graph satisfying the following condition // there exists an edge (u, v) if the condition holds graph.constructedgesfrom(|&u, &v| u != v && (u + v) % 10 == 0);
// (1, 9) should be an edge, since (1 + 9) % 10 == 0 assert!(graph.hasedge( graph.getvertex(1).unwrap(), graph.get_vertex(9).unwrap() )); ```
```rs let mut graph: comtesse::unweighted::Unweighted<_> = ('a'..='f').collect(); graph.constructedgesfrom(|&u, &v| { matches!( (u, v), ('f', 'd') | ('c', 'a') | ('b', 'f') | ('b', 'e') | ('a', 'b') | ('d', 'e') | ('e', 'c') ) });
let a = graph.getvertex('a').unwrap(); let d = graph.getvertex('d').unwrap();
let pathad = graph.shortestpathunweighted(a, d); asserteq!( pathad, ['a', 'b', 'f', 'd'] .iter() .map(|&i| graph.getvertex(i)) .collect(), ); ```