icentral_graph/
find_muc_subgraphs.rs1crate::ix!();
2
3impl<GH> FindMucSubgraphs for Graph<GH>
4
5where GH
6: GetConnectedComponentSizes
7+ ClearMucs
8+ CreateNamedEmpty
9+ ExtendWith<GH,Error=BetweennessCentralityError>
10+ GetEdges
11+ GetNeighborsForNode
12+ GetNodeIdRange
13+ GraphHashMucInterface
14+ HasMapForNode
15+ InsertEdge
16+ InsertNode
17+ IsValid
18+ MappedNodes
19+ NumEdges
20+ NumNodes
21
22{
23
24 fn find_muc_subgraphs(&mut self, muc_id: MinimumUnionCycleId)
31 -> Result<(),BetweennessCentralityError>
32 {
33 debug!("finding muc_subgraphs for muc_id={}", muc_id);
34
35 if self.muc(muc_id).num_nodes() == 1 {
43 return Ok(());
44 }
45
46 if !self.muc(muc_id).is_valid() {
47 return Ok(());
48 }
49
50 let mut to_insert = vec![];
51
52 let muc = self.muc(muc_id);
53
54 if let conn_vertex_map = muc.vertex_map()? {
55
56 for item in conn_vertex_map.iter() {
57
58 let mapping = self.build_graphhash_mapping_for_conn_vertex(
59 item,
60 muc_id
61 )?;
62
63 to_insert.push(mapping);
64 }
65 }
66
67 for (id,g) in to_insert.into_iter() {
68 self.mucs[muc_id.val()].insert_subgraph(id,g);
69 }
70
71 Ok(())
72 }
73}