{"id":13622210,"url":"https://github.com/mrhooray/kdtree-rs","last_synced_at":"2025-10-08T01:07:16.410Z","repository":{"id":51372033,"uuid":"39874848","full_name":"mrhooray/kdtree-rs","owner":"mrhooray","description":"K-dimensional tree in Rust for fast geospatial indexing and lookup","archived":false,"fork":false,"pushed_at":"2024-11-30T07:23:57.000Z","size":100,"stargazers_count":259,"open_issues_count":3,"forks_count":60,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-10-01T13:40:02.977Z","etag":null,"topics":["geo-spatial","index","k-dimensional","nearest-neighbor-search","rust","search","tree"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrhooray.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-07-29T05:20:17.000Z","updated_at":"2025-09-30T12:46:53.000Z","dependencies_parsed_at":"2024-01-14T13:09:59.915Z","dependency_job_id":"51681ae3-d057-4e1e-be88-815173b2dc46","html_url":"https://github.com/mrhooray/kdtree-rs","commit_stats":{"total_commits":81,"total_committers":15,"mean_commits":5.4,"dds":0.4814814814814815,"last_synced_commit":"5e01eb8ee7bec9b381c43762682ecf47e700d690"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/mrhooray/kdtree-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhooray%2Fkdtree-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhooray%2Fkdtree-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhooray%2Fkdtree-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhooray%2Fkdtree-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrhooray","download_url":"https://codeload.github.com/mrhooray/kdtree-rs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhooray%2Fkdtree-rs/sbom","scorecard":{"id":664016,"data":{"date":"2025-08-11","repo":{"name":"github.com/mrhooray/kdtree-rs","commit":"965a9b1cf2a090bc44c16d256f887b371866ee54"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":3,"reason":"Found 9/29 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/rust.yaml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/mrhooray/kdtree-rs/rust.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/rust.yaml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/mrhooray/kdtree-rs/rust.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/rust.yaml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/mrhooray/kdtree-rs/rust.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/rust.yaml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/mrhooray/kdtree-rs/rust.yaml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/rust.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE-APACHE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE-APACHE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 24 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T17:17:05.430Z","repository_id":51372033,"created_at":"2025-08-21T17:17:05.430Z","updated_at":"2025-08-21T17:17:05.430Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278872203,"owners_count":26060535,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geo-spatial","index","k-dimensional","nearest-neighbor-search","rust","search","tree"],"created_at":"2024-08-01T21:01:15.842Z","updated_at":"2025-10-08T01:07:16.366Z","avatar_url":"https://github.com/mrhooray.png","language":"Rust","funding_links":[],"categories":["Libraries","库 Libraries","Rust","Search"],"sub_categories":["Data structures","数据结构 Data structures"],"readme":"# kdtree [![rust](https://github.com/mrhooray/kdtree-rs/actions/workflows/rust.yaml/badge.svg)](https://github.com/mrhooray/kdtree-rs/actions/workflows/rust.yaml) [![crates.io](https://img.shields.io/crates/v/kdtree.svg)](https://crates.io/crates/kdtree) [![docs](https://docs.rs/kdtree/badge.svg)](https://docs.rs/kdtree) [![license](https://img.shields.io/crates/l/kdtree.svg?maxAge=2592000)](https://github.com/mrhooray/kdtree-rs#license)\n\n\u003e K-dimensional tree in Rust for fast geospatial indexing and nearest neighbors lookup\n\n- [Crate](https://crates.io/crates/kdtree)\n- [Documentation](https://docs.rs/kdtree)\n- [Usage](#usage)\n- [Benchmark](#benchmark)\n- [License](#license)\n\n## Usage\n\nAdd `kdtree` to `Cargo.toml`\n\n```toml\n[dependencies]\nkdtree = \"0.7.0\"\n```\n\nAdd points to kdtree and query nearest n points with distance function\n\n```rust\nuse kdtree::KdTree;\nuse kdtree::ErrorKind;\nuse kdtree::distance::squared_euclidean;\n\nlet a: ([f64; 2], usize) = ([0f64, 0f64], 0);\nlet b: ([f64; 2], usize) = ([1f64, 1f64], 1);\nlet c: ([f64; 2], usize) = ([2f64, 2f64], 2);\nlet d: ([f64; 2], usize) = ([3f64, 3f64], 3);\n\nlet dimensions = 2;\nlet mut kdtree = KdTree::new(dimensions);\n\nkdtree.add(\u0026a.0, a.1).unwrap();\nkdtree.add(\u0026b.0, b.1).unwrap();\nkdtree.add(\u0026c.0, c.1).unwrap();\nkdtree.add(\u0026d.0, d.1).unwrap();\n\nassert_eq!(kdtree.size(), 4);\nassert_eq!(\n    kdtree.nearest(\u0026a.0, 0, \u0026squared_euclidean).unwrap(),\n    vec![]\n);\nassert_eq!(\n    kdtree.nearest(\u0026a.0, 1, \u0026squared_euclidean).unwrap(),\n    vec![(0f64, \u00260)]\n);\nassert_eq!(\n    kdtree.nearest(\u0026a.0, 2, \u0026squared_euclidean).unwrap(),\n    vec![(0f64, \u00260), (2f64, \u00261)]\n);\nassert_eq!(\n    kdtree.nearest(\u0026a.0, 3, \u0026squared_euclidean).unwrap(),\n    vec![(0f64, \u00260), (2f64, \u00261), (8f64, \u00262)]\n);\nassert_eq!(\n    kdtree.nearest(\u0026a.0, 4, \u0026squared_euclidean).unwrap(),\n    vec![(0f64, \u00260), (2f64, \u00261), (8f64, \u00262), (18f64, \u00263)]\n);\nassert_eq!(\n    kdtree.nearest(\u0026a.0, 5, \u0026squared_euclidean).unwrap(),\n    vec![(0f64, \u00260), (2f64, \u00261), (8f64, \u00262), (18f64, \u00263)]\n);\nassert_eq!(\n    kdtree.nearest(\u0026b.0, 4, \u0026squared_euclidean).unwrap(),\n    vec![(0f64, \u00261), (2f64, \u00260), (2f64, \u00262), (8f64, \u00263)]\n);\n```\n\n## Benchmark\n\n`cargo bench` with 2.3 GHz Intel i5-7360U:\n\n```\ncargo bench\n     Running target/release/deps/bench-9e622e6a4ed9b92a\n\nrunning 2 tests\ntest bench_add_to_kdtree_with_1k_3d_points       ... bench:         106 ns/iter (+/- 25)\ntest bench_nearest_from_kdtree_with_1k_3d_points ... bench:       1,237 ns/iter (+/- 266)\n\ntest result: ok. 0 passed; 0 failed; 0 ignored; 2 measured; 0 filtered out\n```\n\nThanks [Eh2406](https://github.com/Eh2406) for various fixes and perf improvements.\n\n## License\n\nLicensed under either of\n\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n- MIT License ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any\nadditional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrhooray%2Fkdtree-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrhooray%2Fkdtree-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrhooray%2Fkdtree-rs/lists"}