diff --git a/src/undirected_graph.rs b/src/undirected_graph.rs index 05e8e38db0b86bbf3fa63862b41d3f7d76240250..e651b414318b95fe4c08c5b5e77f14f173f5447e 100644 --- a/src/undirected_graph.rs +++ b/src/undirected_graph.rs @@ -20,10 +20,10 @@ impl UndirectedGraph { } } // TODO: Check there are no double edges. - return UndirectedGraph { + UndirectedGraph { num_vertices, edges, - }; + } } pub fn wheel_graph(num_spokes: usize) -> UndirectedGraph { @@ -31,7 +31,7 @@ impl UndirectedGraph { (0..num_spokes).map(|i: usize| (0, i + 1)).collect(); wheel_edges.extend((0..num_spokes - 1).map(|i: usize| (i + 1, i + 2))); wheel_edges.push((1, num_spokes)); - return UndirectedGraph::new(num_spokes + 1, wheel_edges); + UndirectedGraph::new(num_spokes + 1, wheel_edges) } fn degree_sequence(&self) -> Vec<usize> { @@ -40,7 +40,7 @@ impl UndirectedGraph { degrees[a] += 1; degrees[b] += 1; } - return degrees; + degrees } pub fn to_nauty(&self) -> Vec<u64> { @@ -50,7 +50,7 @@ impl UndirectedGraph { for (a, b) in &self.edges { nauty_Traces_sys::ADDONEEDGE(&mut nauty_graph, *a, *b, m); } - return nauty_graph; + nauty_graph } pub fn from_nauty(nauty_graph: &[u64]) -> UndirectedGraph { @@ -69,7 +69,7 @@ impl UndirectedGraph { vertex_mask >>= 1; } } - return graph; + graph } fn induced_edge_permutation( @@ -80,7 +80,7 @@ impl UndirectedGraph { fn map_edge(relabel_h_to_g: &[i32], e: &(usize, usize)) -> (usize, usize) { let a: usize = relabel_h_to_g[e.0] as usize; let b: usize = relabel_h_to_g[e.1] as usize; - return if a < b { (a, b) } else { (b, a) }; + if a < b { (a, b) } else { (b, a) } } let mapped_edges: Vec<(usize, usize)> = h .edges @@ -107,7 +107,7 @@ impl UndirectedGraph { sign *= -1; } } - return sign; + sign } thread_local! { @@ -234,12 +234,12 @@ impl UndirectedGraph { } }); - return ( + ( sign, normal_self, normal_self_orbits, normal_self_edge_orbits, - ); + ) } fn expand_vertex(&self, &position: &usize) -> Vec<(usize, UndirectedGraph)> { @@ -305,7 +305,7 @@ impl UndirectedGraph { expansion.push((2, dg)); } - return expansion; + expansion } pub fn expanding_differential( @@ -334,7 +334,7 @@ impl UndirectedGraph { } diff.retain(|_dg, (dg_coeff, _)| *dg_coeff != 0); - return diff; + diff } pub fn contractions( @@ -368,10 +368,10 @@ impl UndirectedGraph { } // Shift vertex labeling. if *a > edge.1 { - *a = *a - 1; + *a -= 1; } if *b > edge.1 { - *b = *b - 1; + *b -= 1; } } let mut unique_edges: HashSet<(usize, usize)> = HashSet::new(); @@ -388,6 +388,6 @@ impl UndirectedGraph { contractions.insert(normal_cg, normal_cg_orbits); } } - return contractions; + contractions } }