MCPcopy Create free account
hub / github.com/daniel-e/rustml / expand_cluster

Method expand_cluster

src/dbscan.rs:83–103  ·  view source on GitHub ↗
(&mut self, ppos: usize, neighbours: Vec<usize>)

Source from the content-addressed store, hash-verified

81 }
82
83 fn expand_cluster(&mut self, ppos: usize, neighbours: Vec<usize>) {
84 let c = self.c;
85 self.set_cluster(ppos, c);
86
87 let mut q = neighbours.clone();
88 while q.len() > 0 {
89 let pp = q.pop().unwrap();
90 if !self.visited(pp) {
91 self.visit(pp);
92 let neighbours = self.neighbours(pp);
93 if neighbours.len() >= self.minpts {
94 for n in neighbours {
95 q.push(n);
96 }
97 }
98 }
99 if self.get_cluster(pp) == -2 {
100 self.set_cluster(pp, c);
101 }
102 }
103 }
104}
105
106

Callers 1

computeMethod · 0.80

Calls 6

set_clusterMethod · 0.80
visitedMethod · 0.80
visitMethod · 0.80
neighboursMethod · 0.80
get_clusterMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected