Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

206
Views
KdTree implementation in Javascript

There is a Javascript library kd-tree-javascript that is used to construct kdtree and perform queries like nearest neighbour search and range search.

Link to the library : https://github.com/ubilabs/kd-tree-javascript


const distance = (a: { x: number; y: number }, b: { x: number; y: number }) => {
    return Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2);
};

let's say we have 2D points. the tree is constructed as:

const createdTree = new kdTree(points, distance, ['x', 'y']);

Now my question is how do we define leaf size while creating this tree? just like in python library, there is a parameter for setting leaf size.

class scipy.spatial.KDTree(data, leafsize=10, compact_nodes=True, copy_data=False, balanced_tree=True, boxsize=None)

How do I specify leaf size?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!