mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
Fix inconsistency in day 23.
It works way better when you choose an optimal pivot.
This commit is contained in:
@@ -42,7 +42,7 @@ fn bron_kerbosch1(graph: Graph, cliques: &mut Vec<NodeSet>, r: &mut NodeSet, p:
|
||||
}
|
||||
|
||||
let mut p_clone = p.clone();
|
||||
let pivot = *p.union(&x).next().unwrap();
|
||||
let pivot = *p.union(&x).max_by_key(|&&v| graph[v].len()).unwrap();
|
||||
|
||||
for &v in p.difference(&graph[pivot]) {
|
||||
r.insert(v);
|
||||
|
||||
Reference in New Issue
Block a user