icentral_graph/
construct_single_node_mucs.rs

1crate::ix!();
2
3impl<GH> ConstructSingleNodeMucs 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 maybe_construct_single_node_muc(&mut self, idx: NodeId) {
21
22        if self.nodes_to_mucs.mucid_for_node(idx) == MinimumUnionCycleId::inf() {
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(
31                idx, 
32                muc.id()
33            );
34
35            self.mucs.push(muc);
36        }
37    }
38
39    fn construct_single_node_mucs(&mut self) {
40
41        debug!("constructing single node MinimumUnionCycles...");
42
43        // print_mucs();
44        //
45        // create single vertex muc's
46        //
47        for idx in NodeIdRange::new(0,self.nodes_to_mucs.len()) {
48
49            self.maybe_construct_single_node_muc(idx);
50        }
51    }
52}