From c84d49eff1e7e7664b6ddbac7d53fb0bd13a8ff0 Mon Sep 17 00:00:00 2001 From: Andrew Guschin Date: Sun, 9 Apr 2023 22:21:19 +0400 Subject: Added automatic derives and removed manual impl --- graph-checker/src/graph.rs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'graph-checker/src/graph.rs') 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>, } +#[derive(Clone, PartialEq, Eq)] pub struct Cutset { pub cardinality: usize, pub vertices: Vec, 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 { -- cgit v1.2.3