Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented algorithms for K-Nearest Neighbor Search (KNN) #2554

Merged
merged 9 commits into from
Sep 10, 2024

Conversation

lucaderi
Copy link
Member

@lucaderi lucaderi commented Sep 9, 2024

Please sign (check) the below before submitting the Pull Request:

Describe changes:
Implemented the following API new calls:

  ndpi_kd_tree* ndpi_kd_create(u_int num_dimensions);
  void ndpi_kd_free(ndpi_kd_tree *tree);
  void ndpi_kd_clear(ndpi_kd_tree *tree);
  bool ndpi_kd_insert(ndpi_kd_tree *tree, const double *data_vector, void *user_data);
  ndpi_kd_tree_result *ndpi_kd_nearest(ndpi_kd_tree *tree, const double *data_vector);
  u_int32_t ndpi_kd_num_results(ndpi_kd_tree_result *res);
  double* ndpi_kd_result_get_item(ndpi_kd_tree_result *res, double **user_data);
  void ndpi_kd_result_free(ndpi_kd_tree_result *res);
  double ndpi_kd_distance(double *a1, double *b2, u_int num_dimensions);

   ndpi_btree* ndpi_btree_init(double **data, u_int32_t n_rows, u_int32_t n_columns);
   ndpi_knn ndpi_btree_query(ndpi_btree *b, double **query_data,
                            u_int32_t query_data_num_rows, u_int32_t query_data_num_columns,
                            u_int32_t max_num_results);
   void ndpi_free_knn(ndpi_knn knn);
   void ndpi_free_btree(ndpi_btree *tree);

lucaderi and others added 9 commits September 8, 2024 19:07
…ttps://en.wikipedia.org/wiki/K-d_tree

ndpi_kd_tree* ndpi_kd_create(u_int num_dimensions);
void ndpi_kd_free(ndpi_kd_tree *tree);
void ndpi_kd_clear(ndpi_kd_tree *tree);
bool ndpi_kd_insert(ndpi_kd_tree *tree, const double *data_vector, void *user_data);
ndpi_kd_tree_result *ndpi_kd_nearest(ndpi_kd_tree *tree, const double *data_vector);
u_int32_t ndpi_kd_num_results(ndpi_kd_tree_result *res);
bool ndpi_kd_result_end(ndpi_kd_tree_result *res);
double* ndpi_kd_result_get_item(ndpi_kd_tree_result *res, double **user_data);
bool ndpi_kd_result_next(ndpi_kd_tree_result *res);
void ndpi_kd_result_free(ndpi_kd_tree_result *res);
double ndpi_kd_distance(double *a1, double *b2, u_int num_dimensions);
Copy link

@lucaderi lucaderi merged commit 7fdc4b2 into ntop:dev Sep 10, 2024
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant