diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | graph-checker/src/graph.rs | 17 |
2 files changed, 3 insertions, 15 deletions
@@ -1,5 +1,6 @@ .* !.gitignore +polygon # Rust target 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 { |