| @@ 199-223 (lines=25) @@ | ||
| 196 | return tree; |
|
| 197 | ||
| 198 | ||
| 199 | def __find_nearest_cluster_features(self): |
|
| 200 | """! |
|
| 201 | @brief Find pair of nearest CF entries. |
|
| 202 | ||
| 203 | @return (list) List of two nearest enties that are represented by list [index_point1, index_point2]. |
|
| 204 | ||
| 205 | """ |
|
| 206 | ||
| 207 | minimum_distance = float("Inf");
|
|
| 208 | index1 = 0; |
|
| 209 | index2 = 0; |
|
| 210 | ||
| 211 | for index_candidate1 in range(0, len(self.__features)): |
|
| 212 | feature1 = self.__features[index_candidate1]; |
|
| 213 | for index_candidate2 in range(index_candidate1 + 1, len(self.__features)): |
|
| 214 | feature2 = self.__features[index_candidate2]; |
|
| 215 | ||
| 216 | distance = feature1.get_distance(feature2, self.__measurement_type); |
|
| 217 | if (distance < minimum_distance): |
|
| 218 | minimum_distance = distance; |
|
| 219 | ||
| 220 | index1 = index_candidate1; |
|
| 221 | index2 = index_candidate2; |
|
| 222 | ||
| 223 | return [index1, index2]; |
|
| 224 | ||
| 225 | ||
| 226 | def __get_nearest_feature(self, point): |
|
| @@ 570-596 (lines=27) @@ | ||
| 567 | farthest_node2 = candidate2; |
|
| 568 | ||
| 569 | return [farthest_node1, farthest_node2]; |
|
| 570 | ||
| 571 | ||
| 572 | def get_nearest_successors(self, type_measurement): |
|
| 573 | """! |
|
| 574 | @brief Find pair of nearest successors of the node in line with measurement type. |
|
| 575 | ||
| 576 | @param[in] type_measurement (measurement_type): Measurement type that is used for obtaining nearest successors. |
|
| 577 | ||
| 578 | @return (list) Pair of nearest successors represented by list. |
|
| 579 | ||
| 580 | """ |
|
| 581 | ||
| 582 | nearest_node1 = None; |
|
| 583 | nearest_node2 = None; |
|
| 584 | nearest_distance = float("Inf");
|
|
| 585 | ||
| 586 | for i in range(0, len(self.successors)): |
|
| 587 | candidate1 = self.successors[i]; |
|
| 588 | ||
| 589 | for j in range(i + 1, len(self.successors)): |
|
| 590 | candidate2 = self.successors[j]; |
|
| 591 | candidate_distance = candidate1.get_distance(candidate2, type_measurement); |
|
| 592 | ||
| 593 | if (candidate_distance < nearest_distance): |
|
| 594 | nearest_distance = candidate_distance; |
|
| 595 | nearest_node1 = candidate1; |
|
| 596 | nearest_node2 = candidate2; |
|
| 597 | ||
| 598 | return [nearest_node1, nearest_node2]; |
|
| 599 | ||