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);