diff --git a/src/undirected_graph.rs b/src/undirected_graph.rs index 42bebc784573ccb6c43009be2f705c2ab1594e0e..14b3fa08b001ddb754676a95e6a70402244a9a01 100644 --- a/src/undirected_graph.rs +++ b/src/undirected_graph.rs @@ -36,7 +36,7 @@ impl UndirectedGraph { fn degree_sequence(&self) -> Vec<usize> { let mut degrees = vec![0; self.num_vertices]; - for &(a,b) in &self.edges { + for &(a, b) in &self.edges { degrees[a] += 1; degrees[b] += 1; } @@ -53,16 +53,16 @@ impl UndirectedGraph { return nauty_graph; } - pub fn from_nauty(nauty_graph: &Vec<u64>) -> UndirectedGraph { + pub fn from_nauty(nauty_graph: &[u64]) -> UndirectedGraph { let mut graph: UndirectedGraph = UndirectedGraph { num_vertices: nauty_graph.len(), edges: vec![], }; - for i in 0..nauty_graph.len() { + for (i, word) in nauty_graph.iter().enumerate() { let mut j = i + 1; let mut vertex_mask: u64 = 1 << ((nauty_Traces_sys::WORDSIZE as usize) - 1 - j); while vertex_mask != 0 { - if (nauty_graph[i] & vertex_mask) != 0 { + if (word & vertex_mask) != 0 { graph.edges.push((i, j)); } j += 1;