diff options
| author | Andrew Guschin <guschin.drew@gmail.com> | 2023-04-09 22:21:19 +0400 |
|---|---|---|
| committer | Andrew Guschin <guschin.drew@gmail.com> | 2023-04-09 22:21:19 +0400 |
| commit | c84d49eff1e7e7664b6ddbac7d53fb0bd13a8ff0 (patch) | |
| tree | c1184f1dfd3c0303914b3c7020e59c410f28fbc1 /graph-checker/src | |
| parent | a5bf84189c0df8a2ac5a6f99ca314a1f39c9b697 (diff) | |
Added automatic derives and removed manual impl
Diffstat (limited to 'graph-checker/src')
| -rw-r--r-- | graph-checker/src/graph.rs | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/graph-checker/src/graph.rs b/graph-checker/src/graph.rs index 4c06660..6a49624 100644 --- a/graph-checker/src/graph.rs +++ b/graph-checker/src/graph.rs @@ -1,31 +1,18 @@ use std::fmt; +#[derive(Clone, PartialEq, Eq)] pub struct Graph { pub size: usize, pub matrix: Vec<Vec<i32>>, } +#[derive(Clone, PartialEq, Eq)] pub struct Cutset { pub cardinality: usize, pub vertices: Vec<i32>, pub graph: Graph, } -impl Clone for Graph { - fn clone(&self) -> Self { - let mut matrix = vec![vec![0; self.size]; self.size]; - for row in 0..self.size { - for col in 0..self.size { - matrix[row][col] = self.matrix[row][col]; - } - } - return Graph { - size: self.size, - matrix, - }; - } -} - impl fmt::Display for Graph { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { for row in 0..self.size { |