Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 182813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:00:21+00:00 2026-05-11T15:00:21+00:00

I want to use a data structure for sorting space-time data (x,y,z,time). Currently a

  • 0

I want to use a data structure for sorting space-time data (x,y,z,time).

Currently a processing algorithm searches a set of 4D (x,y,z,time) points, given a spherical (3d) spacial radius and a linear (1d) time radius, marking for each point, which other points are within those radii. The reason is that after processing, I can ask any 4D point for all of its neighbours in O(1) time.

However in some common configurations of space and time radii, the first run of the algorithm takes about 12 hours. Believe it or not, that’s actually fast compared to what exists in our industry. Nevertheless, I want to help speed up the initial runs and so I want to know: Is a kd-tree suitable for 4D space-time data?

Note that I am not looking for implementations of nearest-neighbour search or k-nearest-neighbours search.

More Info:

An example dataset has 450,000 4D points.

Some datasets are time-dense so ordering by time certainly saves processing, but still leads to many distance checks.

Time is represented by Excel-style dates, with typical ranges between 30,000-39,000 (approximate). The space ranges are sometimes higher values, sometimes lower values, but the range between each space co-ordinate is similar to time (e.g. maxX-minX ~ maxT-minT).

Even more info:

I thought I’d add some more slightly irrelevant data in case anybody has dealt with a similar dataset.

Basically I’m working with data that represents space-time events that are recorded and corroborated by multiple sensors. Error is involved, so only events that meet an error threshold are included.

The time span of these datasets ranges between 5-20 years of data.

For the really old data (>8 years old), the events were often very spacially dense for two reasons: 1) there were relatively few sensors available back then, and 2) the sensors were placed close together so that nearby events could be properly corroborated with low error. Further events could be recorded, but they had too high an error

For the newer data (<8 years old), the events are often very time dense, for the inverse reasons: 1) there are usually many sensors available, and 2) the sensors are placed at regular intervals over a larger distance.

As a result, the datasets cannot typically be said to be only time-dense or only spacially dense (except in the case of datasets that contain only new data).

Conclusion

I clearly should be asking more questions on this site.

I will be testing out several solutions over the next while which will include the 4d kd-tree, a 3d kd-tree followed by time distance check (suggested by Drew Hall), and the current algorithm I have. Also, I have been suggested another data structure called TSP (time space partitioning) tree, which uses an octree for space and a bsp on each node for time, so I may test that as well.

Assuming I remember, I’ll be sure to post some profiling benchmarks on different time/space radii configurations.

Thanks all

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T15:00:22+00:00Added an answer on May 11, 2026 at 3:00 pm

    To expand a little bit on my comments to an answer above:

    According to the literature, kd-trees require data with Euclidean coordinates. They are probably not strictly necessary, but they’re certainly sufficient: guaranteeing that all coordinates are Euclidean ensures that the normal rules of space apply, and makes it possible to easily partition points by their location and build up the tree structure.

    Time is a little bit strange. Under the rules of special relativity, you use a Minkowski metric, not a standard Euclidean metric, when you’re working with time coordinates. This causes all kinds of problems (most severe among them destroying the meaning of ‘simultaneity’), and generally makes people afraid of time coordinates. That fear is not well-founded, though, because unless you know you’re working on physics, your time coordinate almost certainly actually will be Euclidean in practice.

    What does it mean for a coordinate to be Euclidean? It should be independent of all the other coordinates. Saying time is a Euclidean coordinate means that you can answer the question ‘Are these two points close together in time?’ by looking only at their time coordinates, and ignoring any extra information. It’s easy to see why not having that property might break a scheme that partitions points by the values of their coordinates; if two points can have radically different time coordinates but still be considered ‘close in time’, then a tree which sorts them by time coordinate is not going to work very well.

    An example of a Euclidean time coordinate would be any time specified in a single, consistent time zone (like UTC times). If you have two clocks, one in New York and one in Tokyo, you know that if you have two measurements labelled ’12:00 UTC’ then they were taken at the same time. But if the measurements are taken in local time, so one says ’12:00 New York time’ and one is ’12:00 Tokyo time’, you have to use extra information about the locations and time zones of the cities to figure out how much time elapsed between the two measurements.

    So as long as your time coordinate is consistently measured and sane, it will be Euclidean, and that means it will work just fine in a kd-tree or similar data structure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 116k
  • Answers 116k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use ShellExecuteEx instead so you can get a handle to… May 11, 2026 at 10:32 pm
  • Editorial Team
    Editorial Team added an answer You will receive an NSNotification object, not an NSDictionary in… May 11, 2026 at 10:32 pm
  • Editorial Team
    Editorial Team added an answer if count > 15 cols = count / ITEMS-PER-COL if… May 11, 2026 at 10:32 pm

Related Questions

I've got a collection of strings, and I need to know the first index
I'm trying to read data in from a binary file and then store in
I'm struggling to create a generic (or untyped) array in C (I'm aware that
What is a good data structure for storing phone numbers in database fields? I'm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.