icentral_graph/
construct_mucs_for_connected_component.rs

1crate::ix!();
2
3impl<GH> ConstructMucsForConnectedComponent<GH> for Graph<GH> 
4
5where GH
6: NumNodes
7+ ExtendWith<GH>
8+ GetConnectedComponentSizes
9+ GetEdges
10+ GetNeighborsForNode
11+ GetNodeIdRange
12+ HasMapForNode
13+ InsertEdge
14+ InsertNode
15+ MappedNodes
16+ NumEdges
17{
18
19    fn maybe_construct_mucs_for_connected_component(
20        &mut self, 
21        component: GH)
22    {
23        if component.num_nodes() >= 3 {
24            self.construct_mucs_for_connected_component(component);
25        }
26    }
27
28    fn construct_mucs_for_connected_component(
29        &mut self,
30        component: GH)
31    {
32        let mut muc = MinimumUnionCycle::<GH>::default();
33
34        muc.set_id(self.mucs.len());
35
36        muc.set_muc_subgraph(component);
37
38        for nodeid in muc.mapped_nodes() {
39
40            self.nodes_to_mucs.set_mucid_for_node(
41                nodeid, 
42                muc.id()
43            );
44        }
45
46        self.mucs.push(muc);
47    }
48}