diff --git a/.gitignore b/.gitignore index 75092bf..67d7a43 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ *.synctex.gz *.bak + +*.csv \ No newline at end of file diff --git a/src/algorithms/bron_kerbosh.rs b/src/algorithms/bron_kerbosh.rs index fea1ce7..e1bc245 100644 --- a/src/algorithms/bron_kerbosh.rs +++ b/src/algorithms/bron_kerbosh.rs @@ -98,7 +98,8 @@ fn bron_kerbosh_aux( // modified p (p \ neighbourhood(pivot)), modified x let (mut ip, mut mp, mut mx) = (p.clone(), p.clone(), x.clone()); let pivot = find_pivot(&p, &x, neighbourhoods); - ip.drain_filter(|e| neighbourhoods[pivot].contains(e)); + ip.extract_if(|e| neighbourhoods[pivot].contains(e)) + .collect::>(); // while !mp.is_empty() { while !ip.is_empty() { @@ -124,7 +125,8 @@ fn bron_kerbosh_aux( // p \ { v }, x U { v } mp.remove(mp.iter().position(|x| *x == v).unwrap()); ip = mp.clone(); - ip.drain_filter(|e| neighbourhoods[pivot].contains(e)); + ip.extract_if(|e| neighbourhoods[pivot].contains(e)) + .collect::>(); mx.push(v); } } @@ -136,7 +138,8 @@ fn find_pivot(p: &[usize], x: &[usize], neighbourhoods: &[Vec]) -> usize *px.iter() .min_by_key(|&e| { let mut pp = p.to_vec(); - pp.drain_filter(|ee| neighbourhoods[*e].contains(ee)); + pp.extract_if(|ee| neighbourhoods[*e].contains(ee)) + .collect::>(); pp.len() }) .unwrap() diff --git a/src/lib.rs b/src/lib.rs index 7f4c3af..535255b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,7 @@ #![feature(int_roundings)] #![feature(iter_collect_into)] -#![feature(drain_filter)] -#![feature(option_result_contains)] -#![feature(hash_drain_filter)] +#![feature(extract_if)] +#![feature(hash_extract_if)] pub mod aapp; pub mod algorithms;