mirror of
https://github.com/aziis98/asd-2024.git
synced 2026-10-06 14:44:59 +00:00
inizio mattina di martedì
This commit is contained in:
@@ -132,15 +132,13 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn restricted(&self, nodes: &Vec<V>) -> AdjacencyGraph<V> {
|
pub fn restricted(&self, nodes: &Vec<V>) -> AdjacencyGraph<V> {
|
||||||
let index = nodes.iter().collect::<BTreeSet<_>>();
|
let nodes_index = nodes.iter().collect::<BTreeSet<_>>();
|
||||||
let mut restricted = AdjacencyGraph::new();
|
let mut restricted = AdjacencyGraph::new();
|
||||||
|
|
||||||
for node in nodes {
|
for node in nodes {
|
||||||
restricted.add_node(node.clone());
|
|
||||||
|
|
||||||
if let Some(adjacencies) = self.get_adjacencies(&node) {
|
if let Some(adjacencies) = self.get_adjacencies(&node) {
|
||||||
for adj in adjacencies {
|
for adj in adjacencies {
|
||||||
if index.contains(adj) {
|
if nodes_index.contains(adj) {
|
||||||
restricted.add_edge(node.clone(), adj.clone());
|
restricted.add_edge(node.clone(), adj.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,6 +164,11 @@ where
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"Edge count: {}, Total edge count: {}",
|
||||||
|
graph.edges().count(),
|
||||||
|
edge_types.len()
|
||||||
|
);
|
||||||
println!("Edge types histogram (type/count):");
|
println!("Edge types histogram (type/count):");
|
||||||
for (edge_type, count) in histogram.iter() {
|
for (edge_type, count) in histogram.iter() {
|
||||||
println!("- {:?}: {}", edge_type, count);
|
println!("- {:?}: {}", edge_type, count);
|
||||||
|
|||||||
Reference in New Issue
Block a user