summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--graph-checker/src/graph.rs17
2 files changed, 3 insertions, 15 deletions
diff --git a/.gitignore b/.gitignore
index 0f66a9c..5f7a78c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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 {