From b0d9573419c391d60137c41a2b8be696fa868e45 Mon Sep 17 00:00:00 2001 From: Antonio De Lucreziis Date: Tue, 29 Oct 2024 10:20:04 +0100 Subject: [PATCH] =?UTF-8?q?inizio=20mattina=20di=20marted=C3=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graph/algorithms.rs | 6 ++---- src/main.rs | 5 +++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/graph/algorithms.rs b/src/graph/algorithms.rs index 534a950..6c78ab4 100644 --- a/src/graph/algorithms.rs +++ b/src/graph/algorithms.rs @@ -132,15 +132,13 @@ where } pub fn restricted(&self, nodes: &Vec) -> AdjacencyGraph { - let index = nodes.iter().collect::>(); + let nodes_index = nodes.iter().collect::>(); let mut restricted = AdjacencyGraph::new(); for node in nodes { - restricted.add_node(node.clone()); - if let Some(adjacencies) = self.get_adjacencies(&node) { for adj in adjacencies { - if index.contains(adj) { + if nodes_index.contains(adj) { restricted.add_edge(node.clone(), adj.clone()); } } diff --git a/src/main.rs b/src/main.rs index 67bd923..5c672ba 100644 --- a/src/main.rs +++ b/src/main.rs @@ -164,6 +164,11 @@ where }, ); + println!( + "Edge count: {}, Total edge count: {}", + graph.edges().count(), + edge_types.len() + ); println!("Edge types histogram (type/count):"); for (edge_type, count) in histogram.iter() { println!("- {:?}: {}", edge_type, count);