icentral_graph/
create_single_vertex_mucs.rs

1crate::ix!();
2
3impl<GH> CreateSingleVertexMucs for Graph<GH> 
4
5where GH
6: GetConnectedComponentSizes
7+ ExtendWith<GH>
8+ GetEdges
9+ GetNeighborsForNode
10+ GetNodeIdRange
11+ HasMapForNode
12+ InsertEdge
13+ InsertNode
14+ MappedNodes
15+ NumEdges
16+ NumNodes
17
18{
19
20    fn create_single_vertex_muc(
21        &mut self, 
22        idx: NodeId) 
23    {
24        let mut muc = MinimumUnionCycle::<GH>::default();
25
26        muc.set_id(self.mucs.len());
27
28        muc.insert_node(idx);
29
30        self.nodes_to_mucs.set_mucid_for_node(idx, muc.id());
31
32        self.mucs.push(muc);
33    }
34
35    fn maybe_create_single_vertex_muc(
36        &mut self, 
37        idx: NodeId) 
38    {
39        if self.nodes_to_mucs.mucid_for_node(idx) == MinimumUnionCycleId::inf() {
40
41            self.create_single_vertex_muc(idx);
42        }
43    }
44
45    fn create_single_vertex_mucs(&mut self) {
46
47        // print_mucs();
48        // create single vertex muc's
49        for idx in NodeIdRange::new(0,self.nodes_to_mucs.len()) {
50
51            self.maybe_create_single_vertex_muc(idx);
52        }
53    }
54}