Procedures for conducting K-nearest neighbor queries

The preprocessing method for K-NN queries in distributed computing systems addresses inefficiencies by partitioning datasets and calculating object ranges, ensuring efficient and accurate K-NN results with reduced computational and communication overhead.

DE102025129193A1Pending Publication Date: 2026-02-05ORDNANCE SURVEY LTD HAMPSHIRE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
DE102025129193
Authority / Receiving Office
DE · DE
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-07-30
Filing Date
2025-07-24
Publication Date
2026-02-05

AI Technical Summary

Technical Problem

Existing methods for performing K-nearest neighbor (K-NN) queries in large-scale distributed or parallel computing environments are inefficient due to redundant processing, excessive data communication, and computational overhead, especially when dealing with large object sets and multiple queries, as they often require repeated spatial expansions and re-executions, leading to significant computational effort and data handling challenges.

Method used

A preprocessing method that partitions spatial datasets based on a specific scheme, determining K candidate objects for each partition, calculating an object range, and using this information to efficiently perform K-NN queries by minimizing data processing and communication between nodes, ensuring accurate results without redundant computations.

Benefits of technology

The method enables efficient and accurate K-NN queries by reducing the data processed by each processor, minimizing redundant computations, and optimizing data communication, thus enhancing performance and reducing processing power requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

A computer-based method for performing K-nearest neighbor (K-NN) queries on spatial data in distributed or parallel systems. The data consists of query and object data. The query domain is pre-partitioned, with an object domain calculated for each partition based on its geometry and K candidate objects. This domain determines the relevant objects for the K-NN query. If the query dataset is also partitioned in the same way, suitable objects can be retrieved selectively. The partitions and their objects are distributed across multiple processors, significantly reducing the amount of data per processor. Only objects within the respective object domain are considered. This method enables efficient, large-scale K-NN queries with low computational and data overhead while maintaining high accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical FieldEmbodiments of the present invention relate to a computer-implemented method and system for performing K-nearest neighbor (K-NN) queries (also known as K-NN search) on metric data sets such as spatial and network data in a distributed or parallel computing environment. More particularly, the present invention relates to a method for performing K-NN queries in a distributed or parallel computing system in which the dataset to be queried is pre-processed to obtain information that efficiently enables subsequent large-scale repeated K-NN queries.BACKGROUND OF THE INVENTION AND PRIOR ARTMetric data sets contain data from which a distance metric can be defined. One of the most common examples of a metric data set is a spatial data set used as a means for storing and retrieving data representing objects defined in geographic space and used for storing and analyzing information about different geographic areas. Within the spatial dataset, objects of the geographic area may be represented as point features, line features, and area features. For example, individual landmarks may be represented as point features, road networks, railroad lines, coastlines, and waterways may be represented as line features, and building contours and geographical regions such as cities, districts, or states may be represented as area features.A K-nearest neighbor (K-NN) query is one of the most frequently performed queries in a spatial dataset as well as other types of metric datasets. For example, a single K-NN query may be a search for the K=6 closest root schools to an address "X", where schools are the objects to be queried and each address is a query location. Generally, in a central database system on a single computer, a single K-NN query can be easily solved and most spatial database servers are optimized to handle K-NN queries through the use of suitable spatial indices, for example, an R-tree data structure.However, if the size of the object set is very large and / or if a very large number of queries are to be performed, the K-NN queries must be performed in a distributed or parallel computing environment with multiple compute nodes. The key to efficient parallel computation is to partition the data to be processed into multiple units, so that each unit can be independently processed by a single computing node, if possible, and communication between nodes is minimized or eliminated (for some environments). Although in the case of K-NN queries it is easy to partition queries into multiple units that are each processed on an individual compute node, it is difficult to determine the subset of the object set required to process a query unit because the K nearest neighbors of a query are unknown prior to processing and could include all members of the object set. Because it is inefficient or impractical (e.g., in cases where the object set is very large) to pass the entire object set to each compute node, a method of identifying a subset of the object set that is large enough to contain the K nearest neighbors for all queries in a query unit, but small enough to fit within the capacity of a single compute node is needed.Current systems, in the case of spatial data sets, first partition the queries spatially, then for each query partition, retrieve an object set having a spatial extent that is conventionally generated by buffering the query partition geometry over a certain distance. If the retrieved object contains at least K objects and for all queries in the partition, the distance from each query to its Kth nearest neighbor object in the retrieved object set is not greater than the distance from the query to the closest point at the boundary of the aforementioned spatial extent for the object retrieval, then the query process for that partition is complete. If this is not the case (i.e. the distance from a query to its Kth nearest neighbor object determined from the retrieved object set is greater than the distance to the closest point at the boundary), there may be objects that are closer to the query location but outside the current spatial extent and therefore not retrieved. Consequently, this spatial extent may need to be increased repeatedly to retrieve more and more objects until the criteria for completion are met.There are several problems with such an approach. First, the repeated expansion of spatial expansion and retrieval of objects are often expensive operations in a distributed / parallel computing environment. Second, in the case of an extension, some (in an attempt to track queries that have met the criteria) or all queries must be re-executed, increasing the computational effort required. Finally, this process is unique and needs to be repeated again when another set of queries is performed on the object set.Another approach used by some current systems to handle a very large object set is to divide the object set into many partitions small enough to be processed on a compute node, and then for a query location, the K-NN query is performed in each of the object partitions to return a set of up to K objects from each partition. All of the returned objects from the processing of the various partitions are then merged and filtered to obtain the K next objects to the query location as a final result.This approach, too, has severe restrictions. This method effectively performs a query on the entire object dataset to find the K-NN objects that are usually located near the query location. As a result, most of the processing that takes place in all of the partitions is redundant, but the redundancy cannot be reduced due to the fact that it is not known with respect to which portions of the processing it is redundant until all results are returned, merged and filtered. Such a large redundancy in processing also has two undesirable effects, which significantly affect the interrogation performance in a distributed / parallel environment. First, the volume of data communication between nodes will be enormous; second, to process a large number of queries, it can only be performed in small batches, which can introduce additional effort. If a large query stack is sent, the overall size of the results returned by all partitions may be so large as to exceed the capacity of the compute node to handle the merge / filter tasks.Summary of the InventionEmbodiments of the present invention overcome the aforementioned problems by providing a computer-implemented method and system for performing K-nearest neighbor (K-NN) queries on a metric dataset, such as a spatial dataset, in a distributed or parallel computing system, where the dataset includes query data (i.e., query locations) and object data (i.e., the data to be queried). The spatial extents in which the query data and the object data are defined (typically defined as the regions bounding the query data and the object data and referred to herein as the query space and the object space, respectively) may be identical or overlapping one another, and in some cases may be completely separated from one another. The spatial data set is preprocessed, where the sample space is partitioned according to a specific partitioning scheme. For each partition, an area within the union of the query space and the object space (defined as the object area of the partition) is calculated based on the geometry of the partition and K candidate objects selected from the object set such that the distance from each location in the partition to the furthest object in the K candidate objects is not greater than the distance from the same location to the closest point at the boundary of the object area. Accordingly, if the query dataset is subsequently partitioned using the same partition scheme (e.g., to perform a K-NN query), for each partition, the pre-processed object range information may be used to retrieve a set of objects that includes at least the K candidate objects. The inclusion of the K-NN objects for each query location within the partition is ensured. That is, if there are additional objects within the object range of the partition, the K-NN of a query location in the partition is determined from the K candidate objects plus the additional objects within the partition, and if there are no additional objects within the object range, the K candidate objects are the K-NN objects of the query location.Comprehensive K-NN queries can then be performed by distributing the partitions between multiple processors of a distributed or parallel computing system along with the objects retrieved using the pre-processed object range information. In this case, the amount of data to be processed by each processor is significantly reduced, since it is not necessary to query the entire object data record for each query location. Instead, for all interrogation locations within a partition, only the objects defined by the object range of that partition need be interrogated, thereby enabling extensive K-NN interrogations to be performed efficiently and without the need for significant processing power or extensive data communication between processing means to obtain the additional objects, while at the same time ensuring an accurate set of results for each interrogation.A first aspect of the present invention provides a computer-implemented method for performing K-nearest neighbor (K-NN) queries on a spatial dataset in a distributed or parallel computing system, the distributed or parallel computing system comprising a plurality of processing means and the spatial dataset comprising a query dataset and an object dataset, the method comprising receiving instructions for performing a K-NN query on the spatial dataset to find a set of k-NN objects for a plurality of query locations of the query dataset, wherein k is an integer greater than or equal to one, generating a plurality of partitions of the query dataset according to a first partition scheme, determining, for each partition of a set of objects to be queried from the object dataset based on preprocessed object region information associated with the partition and K candidate objects associated with each partition, where K is an integer greater than or equal to the integer value of k, the preprocessed object region information determined using the first partition scheme, distributing the plurality of partitions and the respective sets of objects to be queried between the plurality of processing means for performing the K-NN query, wherein each processing means processes one or more partitions to determine a set of k-NN objects associated with each query location of a partition, receiving one or more sets of k-NN objects from each processing means and collating the one or more sets of k-NN objects from each processing means for output.Accordingly, the spatial extent of the query data (i.e., the region bounding the query data) is partitioned according to the specific scheme, and then preprocessed object area information is used to identify the objects to be query as part of each partition. In doing so, the object range information defines the extent of the object dataset that must be queried for performing queries in each partition. One or more partitions may then be sent to each of the processors of a distributed or parallel computing system to perform the K-NN query for each query location within the partition on the relevant set of objects. The results are then returned and collated for output. In this regard, the method may further include outputting the K-NN results to a display in any suitable format, for example. For example, in the case of geodata, the K-NN results may be output in a visual representation of a map. By using the preprocessed object range information to identify the objects to be queried for each partition, the amount of data to be processed by each processor is significantly reduced, thereby enabling extensive K-NN queries to be performed efficiently and without the need for significant processing power, while at the same time ensuring an accurate result set for each query. It will also be understood that the K candidate objects are a predetermined number of candidate objects, where 1≤k≤K.In some arrangements, the plurality of partitions are generated such that each partition includes at least one query location. In this regard, it should be understood that each partition may include multiple query locations. Similarly, it will be appreciated that a query location may fall within multiple partitions, for example, if a query location falls on a boundary between two partitions.In some cases, generating the plurality of partitions may include receiving pre-processed partition data for the query dataset, wherein the pre-processed partition data includes the plurality of partitions. The preprocessed object area information may include the set of objects to query for each partition. That is, the objects to be queried may be preprocessed and stored for use in performing subsequent K-NN queries.Alternatively, the preprocessed object area information may include an object area for each partition, the object area including one or more faces of the spatial dataset, each face enclosed by a circle having a radius calculated based on a maximum distance between a vertex of the boundary of the partition and K candidate objects assigned to the partition. Accordingly, the object region defines the portion of the spatial dataset from which objects are to be retrieved for use in performing K-NN queries in the given partition. In this regard, the object region of a partition may be defined as the union of all the faces computed for each vertex of the partition boundaries.In such cases, the method may further comprise preprocessing the spatial dataset to determine the object range of each partition, wherein the preprocessing comprises identifying each vertex of the boundaries of the partition, assigning K candidate objects to the partition, calculating an area enclosed by a circle having a radius calculated based on the maximum distance between the vertex and the K candidate objects for each vertex of the partition boundary, and determining the object range of the partition based on a union of the areas calculated for each vertex of the partition boundary.As mentioned above, it should be appreciated that the K candidate objects are a predetermined number of candidate objects, where K may be an integer value greater than or equal to one. The candidate objects used to calculate the object range may therefore be any K candidate objects from the object set, but it is most efficient to select candidate objects so as to minimize the size of the resulting object range. In addition, an object range calculated for a given K value supports k-NN queries in the partition for each 1≤k≤K. In the case of k=K, the object range achieves its maximum efficiency; in the cases of k<K, the object range calculated at K contains some objects that are redundant for the smaller k, and is less efficient compared to an object range calculated for the smaller k. Alternatively, multiple object ranges for different numbers of candidate objects may be individually computed to support multiple K-NN queries of different size K.Accordingly, it will be appreciated that the size of the partitions and / or the number and distribution of candidate objects may be selected to provide an object area (and thus a set of objects to be queried) small enough to be efficiently processed by each processing means.It will also be appreciated that the distance metric used to calculate the object range may depend on the nature of the data to be interrogated.In some arrangements, determining the set of objects to query for each partition may include identifying the objects within the area calculated for each vertex of the partition boundary. More specifically, the objects can be identified within the union of the surfaces computed for each vertex.Collating the one or more sets of k-NN objects may include identifying a query location that is processed within two or more partitions such that two or more sets of k-NN objects are received, removing any duplicated k-NN objects contained within the two or more sets of k-NN objects, and rows of remaining k-NN objects depending on a distance from the query location and each k-NN object, thereby providing a final set of k-NN objects to the query location.Accordingly, if a query location is covered by two or more partitions (e.g., located on a boundary), the query location is processed as part of each respective partition, each partition having its own object region and respective set of objects to be queried. Accordingly, two or more sets of results are returned for the query location, and therefore any conflict between these results must be resolved. This can be done by removing all duplicated results and then comparing the remaining results based on their distance to the query location to find the final k-NN objects. If more than k results are found, those that are furthest removed are discarded until only more k objects are left.The first partition scheme may include one of: a raster system, a quadtree, or a Voronoi diagram. It will of course be appreciated that, depending on the size, distribution and / or nature of the data, any suitable scheme may be used to partition the query dataset.In some examples, the spatial dataset may include geodata representing a geographic region.In some arrangements, the query dataset and the object dataset may include one or more of: data points, line segments, and polygons.In some arrangements, the plurality of processing means may also be used to generate the plurality of partitions and / or determine the set of objects to be interrogated in each partition.Another aspect of the present invention provides a system comprising a processor and a computer readable medium storing one or more instruction(s) configured to, when executed, cause the processor to perform the method for performing K-NN queries as described above.The system may further include a distributed computing system including a plurality of compute nodes, wherein the plurality of partitions are distributed between the plurality of compute nodes.Alternatively, the system may further comprise a parallel computer system comprising a plurality of processors, the plurality of partitions being distributed between the plurality of processors.Another aspect of the present invention provides a computer-implemented method for preprocessing a spatial dataset for use in K-nearest neighbor (K-NN) queries to be performed in a distributed or parallel computing system, the spatial dataset comprising a query dataset and an object dataset, the method comprising generating a plurality of partitions of the query dataset according to a first partition scheme, assigning K candidate objects from the object dataset to each partition, wherein K is an integer greater than or equal to one, determining an object range for each partition, wherein the object range of each partition comprises one or more faces of the spatial dataset, wherein each face is enclosed by a circle having a radius, calculated based on a maximum distance between a vertex of a boundary of the partition and the K candidate objects, and storing object range information for use in K-NN querying the spatial dataset, wherein the object range information comprises at least the object range determined for each partition.Accordingly, the spatial data is preprocessed by partitioning the query space according to a specific scheme and then calculating the object area for each partition using the K candidate objects assigned to each partition (where K≥1). Here, the object region defines the portion of the spatial dataset from which objects are to be retrieved for use in performing K-NN queries in the given partition. This object range geometry can then be stored and used spontaneously to retrieve objects for queries in the corresponding partition. By pre-processing and storing this information, large K-NN queries can be performed efficiently and without the need for significant processing power or extensive data communication between processing means, while at the same time ensuring an accurate set of results for each query.In addition, an object range computed for a given K value supports k-NN queries in each partition for each 1≤k≤K. Accordingly, such preprocessing ensures the inclusion of the K-NN objects for each query location within the partition. That is, if there are additional objects within the object range of the partition, the K-NN of a query location in the partition is determined from the K candidate objects plus all additional objects within the partition, and if there are no additional objects within the object range, the K candidate objects are the K-NN objects of the query location.In such arrangements, determining the object range for each partition may include identifying each vertex of the boundaries of the partition, assigning K candidate objects to the partition, calculating an area enclosed by a circle having a radius calculated based on the maximum distance between the vertex and the K candidate objects for each vertex of the partition boundary, and determining the object range of the partition based on a union of the areas calculated for each vertex of the partition boundary.The candidate objects used to calculate the object range may be any K candidate objects, but it should be appreciated that the size of the partitions and / or the number and distribution of the candidate objects may be selected to provide an object range (and thus a set of objects to be queried) that is small enough to be efficiently processed during a K-NN query.It will of course be appreciated that the distance metric used to calculate the object range may depend on the nature of the data to be interrogated.In some arrangements, assigning K candidate objects may include assigning a predetermined number of candidate objects to each partition based on an inclusion within the partition and / or a neighborhood of the partition. That is, each partition may be assigned a given number of candidate objects, with candidate objects being assigned based on whether they are included within the partition or in close proximity. For example, if K=3 objects are allocated to each partition and one partition has only two objects contained therein, the nearest object in an adjacent partition can also be allocated to that partition.In some embodiments, storing object area information may further include storing the plurality of partitions as partition data.In other arrangements, storing object range information may further comprise storing object data for use in K-NN queries, the object data comprising one or more objects contained within a spatial dataset surface defined by the object range of each partition. That is, the set of objects within each object range may also be stored for use in subsequent K-NN queries, rather than using the object range geometry to spontaneously retrieve objects.The method may further include determining a plurality of object regions for each partition based on two or more sets of K candidate objects for each partition, each set of K candidate objects including a different number of objects. That is, different sets of candidate objects may be used to calculate multiple object ranges to support multiple K-NN queries of different size K. Although an object range calculated for K objects also supports a k-NN query for each 1≤k≤K, it is most efficient if k=K, so it may be advantageous to calculate a dedicated object range for different K values to support a range of k-NN values.The first partition scheme may include one of: a raster system, a quadtree, or a Voronoi diagram. It will of course be appreciated that, depending on the size, distribution and / or nature of the data, any suitable scheme may be used to partition the query dataset.In some examples, the spatial dataset may include geodata representing a geographic region.The object dataset may include one or more of the following: data points, line segments, and polygons.Another aspect of the present invention provides a system comprising a processor and a computer readable medium storing one or more instruction(s) configured to, when executed, cause the processor to perform the method of preprocessing the spatial dataset for use in K-NN queries as described above.It will of course be understood that the method of preprocessing the spatial data set may be performed by a distributed or parallel computing system comprising a plurality of processing means. For example, once partitions have been generated, each partition may be distributed to a processing means to determine the object area of each partition.Brief Description of the DrawingsFurther features and advantages of the present invention will become apparent from the following description of embodiments thereof, which are for illustrative purposes only, and by reference to the drawings, wherein: FIG. 1 is a flow diagram illustrating a method for preprocessing a dataset for use in K-NN queries in accordance with the present invention; FIG. 2 is a flow diagram illustrating a method for performing K-NN queries on a dataset in accordance with the present invention; FIGS. 3A-3D illustrate metrics used in embodiments of the present invention; FIGS. 4A-4D illustrate further metrics used in embodiments of the present invention; FIGS. 5A-5B illustrate further metrics used in embodiments of the present invention; FIG. 6 is a diagram illustrating object areas used in embodiments of the present invention; FIGS. 7A-B are diagrams illustrating object regions used in embodiments of the present invention; FIG. 8 is another diagram illustrating object areas used in embodiments of the present invention; FIGS. 9A-9B are further diagrams illustrating object regions used in embodiments of the present invention; FIGS. 10A-10B are further diagrams illustrating object regions used in embodiments of the present invention; FIG. 11 is another diagram illustrating object areas used in embodiments of the present invention; FIG. 12 is a diagram further illustrating object areas used in embodiments of the present invention; FIGS. 13A-13B are further diagrams illustrating object regions used in embodiments of the present invention; FIG. 14 is still another diagram illustrating object areas used in embodiments of the present invention; FIG. 15 is another diagram illustrating object areas used in embodiments of the present invention; FIGS. 16A-16D are diagrams further illustrating a partition scheme that may be implemented in embodiments of the present invention; FIGS. 17A-17B are diagrams further illustrating a partition scheme that may be implemented in embodiments of the present invention; FIG. 18 is a diagram illustrating an object area of a partition that may be implemented in embodiments of the present invention; FIG. 19 illustrates an example of a system on which the present invention may be implemented; FIGS. 20A-D are diagrams illustrating the process of partitioning a network in embodiments of the present invention; FIG. 21 is another diagram illustrating object areas used in embodiments of the present invention; FIG. 22 is a diagram illustrating the partitioning of a spatial network in embodiments of the present invention; Figure 23 is a diagram further illustrating the present invention.DETAILED DESCRIPTION OF THE DRAWINGSAs mentioned above, although K-nearest neighbor (K-NN) queries are a common type of query on metric data, such as spatial data sets, this is particularly inefficient in specific cases, particularly in cases where the size of the object set exceeds the capacity of a single computer and / or the number of queries is so large that the queries must be performed in a distributed or parallel computing environment.One of the characteristics of K-NN queries is that the area of the neighborhood search to be performed before the search is unknown and depends on the location of the search and the distribution of objects in the object dataset. On the one hand, the search process must find at least K objects, but on the other hand, the search process must also ensure that no other objects are closer to the query location than the found K objects. This is also complicated in cases where the query location can be represented by multiple points (e.g., in the case of spatial data such as line strings or a polygon). In the present invention, a data set is preprocessed and the results of the processing are stored for use in performing extensive K-NN queries in a distributed or parallel computing environment.OverviewFIG. 1 illustrates a method for preprocessing a dataset for use in performing repeated and comprehensive K-NN queries in a distributed or parallel computing environment, in accordance with the present invention. In this case, the query space (i.e. the extent of the query data record) is first partitioned, wherein each partition K is assigned candidate objects. For each partition, an "object area" is calculated based on the extent of the partition and the K candidate objects assigned to the partition. Further details on the "object area" are described below. Finally, the object area and all associated information are stored for use in subsequent K-NN queries.FIG. 2 illustrates a method for performing K-NN spatial queries on an object dataset in accordance with the present invention using the pre-processed data. Here, once a set of K-NN queries is received, the queries are partitioned using the same partition framework as that used to partition the query space during preprocessing. The preprocessed object range information is then used to determine an object set for each partition, and the K-NN query is then performed on the determined object set. The results of the K-NN query are then collated and output for use, for example, by generating an appropriate visual representation of the K-NN data.The details of the preprocessing and method for performing K-NN queries will now be described.DefinitionsFor a better understanding of the following discussion, we hereby provide the following definitions which are used throughout the following description.Given a metric space (X, d), where X is a non-empty set of data points and d: X×X→R is a metric (also referred to as a distance function) defined on X, we first define the following:d(q, o)(q, o ∈ X): the original metric of the distance between two data points (q, o) in X.Object O = {o i| i = 1, 2,..} ≅ X: An object O is a subset on X, where o i denotes a data point on X. The number of data points in the subset may be finite or infinite. A single point object is a set containing only one element. A multipoint object may be a finite collection of discrete data points or a set of infinite data points (e.g., lines or polygons in the case of a spatial dataset).Query Q = {q i| i = 1, 2,.. } ® X: a query is a subset on X, where q i denotes a point on X. The number of data points in the subset may be finite or infinite. A single point query is a set that contains only one element. A multipoint query may be a finite collection of discrete data points or a collection of infinite data points (e.g., lines or polygons).Object set O S= { O i| i=1,n}: a set of objects to be queried. In this regard, it will be understood that each object in the object set is itself a set of data points.Query Set Q S= { Q i| i = 1, m}: a set of queries. In this regard, it will be understood that each query in the query set is itself a set of data points.Next, define as follows:MinIst(q, O) (q ∈ X, O ≅ X) = inf{d(q, o): o ∈ O}: minimum distance between a data point q and a set (i.e., an object), which is the distance between the data point and the closest point in the set, as illustrated in FIG. 3A. This notation can be extended to MinIst(q, O P) where O P is a set of sets (i.e., an object set).MinIst(Q, O) (Q, O ® X) = inf{d(q, o) : q ∈ Q, o ∈ O} = inf{MinIst(q, O) : q ∈ Q}: minimum distance between a query and an object (i.e., two sets of data points), which is the smallest distance between a point in Q to a point in O, as illustrated by FIG. 3B.MinIst(Q, O P) = inf{MinDist(Q O): O ∈ O P}: minimum distance between a query and an object set, as illustrated by FIG. 3C.MinIst(Q P, O P) = inf{MinDist(Q O P) ∈ Q P}: minimum distance between a query set and an object set, as illustrated by FIG. 3D.MaxIst(q, O) (q ∈ X, O ≅ X) = sup{d(q, o): o ∈ O}: maximum distance between a data point and a set, which is the distance between the data point and the furthest point in the set relative to the data point, as illustrated in FIG. 4A. This notation can be extended to MaxIst(q, O P) where Q P is a set of sets.MaxIst(Q, O) = sup{d(q, o): q ∈ Q, o ∈ O} = sup{MaxDist(q, O):q ∈ Q}: maximum distance between a query and an object, which is the largest distance from a point in Q to a point in O, as illustrated in FIG. 4B.MaxIst(Q, O P) = sup{MaxDist(Q 0): 0 ∈ O P}: maximum distance between a query and an object set, as illustrated by FIG. 4C.MaxIst(Q P, O P) = sup{MaxIst(Q, O P) ∈ Q P}: maximum distance between a query set and an object set, as illustrated by FIG. 4D.MaxMinIst(Q, O) = sup{MinDist(q, O): q ∈ Q}: the maximum value of the minimum distance from each point in a query Q to the closest point in an object O (also known as the semi-Hausdorff distance that is directed), as illustrated by FIG. 5A.MaxMinIst(q, O P) = sup{MinIst(q, O): O ∈ O P}: maximum of the minimum distance from a point q to an object set O P, as illustrated by FIG. 5B.It is also worth noting that in the above definitions, "inf" and "sup" denote the largest lower limit and the smallest upper limit, respectively. In addition, for two single point sets {q} and {o} all of the above extended metric definitions are simplified to the original metric d(q,o), i.e. the distance between two data points.Based on the above notations, the K-NN query can be formally defined as follows: Given a metric space (X, d), an object set O S and a query set Q S, defined on (X, d), for each query Q in Q S the K closest objects are found in O S where MinIst(Q, O) is normally used to rank the proximity of objects to a query, although other extended distance metrics can also be used for the query.Object Space and Query SpaceTheoretically, objects and queries can appear at any location of the metric space in which they are defined. For each practical problem, they are represented in subset regions of the metric space, i.e., the spatial extent in which the object and query data is defined. The metric space subset regions in which objects and queries may be defined are considered object space and query space. These two spaces are not necessarily identical. Indeed, they may partially overlap or not intersect each other at all.Object RegionsAs will be described in greater detail below, embodiments of the present invention employ a concept referred to herein as an "object region", and the following discussion provides background on the principles upon which the present invention is based. Generally speaking, for a given object set and a given K for a query set, which may be a finite collection of concrete queries or a subset region of the query space in which an infinite number of queries can be defined, an object region for the query set is a subset region of the metric space that intersects the K nearest neighbors for all queries in the query set. By definition, the query set and the objects retrieved by the corresponding object region can be processed independently of other objects in the object set. Thus, if the query space is divided into multiple partitions that cover the entire query space, an object area may be defined for each partition. Subsequently, each pair of query space partition and object area can be processed independently.It should be appreciated that the object range may not be unique to a query set. Based on the metrics used, there is a minimum object area for a partition, and each area in the sample space that contains this minimum object area is also an object area for the partition. In fact, as a subset region covering the entire object set, the object space is an object range for all query sets. A small object range normally results in a smaller number of objects to be interrogated and better performance.The following discussion provides further details on how the object range is determined and scaled for use in performing extensive K-NN queries in a distributed or parallel computing environment.Object Area for Single Point K-NN QueryGiven an integer of 1 ≤ K ≤ n, a single point query Q = {q} and a set of objects O K= { O i| i = 1, K} ® O S as candidate object set, it is possible to define a set OR(Q, O K) on X as object range for the query Q{q} at k ≤ K with respect to O K as follows:Subsequently, taking K-NN(Q,O S) as the K nearest neighbors in O S for Q, one can claim the following:FIG. 6 shows an example of the object range (denoted by line 600) for a single point query q on a candidate object set O K= { o 1, o 2, o 3}, where the candidate object set O K is a subset of the object set O S( i.e., the set of objects to be queried). The method by which the candidate object set is selected is described in more detail below. As illustrated by FIG. 6, the object region 600 has a circular shape with a center q and a radius MaxMinIst(q, O K) which is the maximum value of the minimum distance of q to each of the data points within the object set O K. In this example, the radius corresponds to the distance from the sample point q to the nearest data point on the object o 3.By definition, at least one data point of all objects in the candidate object set intersects with the object region 600. If there are other objects O T= { O | O ∈ (O S- O K)} that are not in the candidate set and intersect the object region (e.g., object o 4 and o 5 of FIG. 6 ), K-NN for query Q is dragged from O K O T (i.e., the query is performed on objects in both sets), where O K ensures the presence of K nearest neighbors for query Q={q} in the event that there are no other objects of interest for the object region.Object Area for Multiple Single Point QueriesGiven a plurality of single point queries Q P= { Q i= { q i}: i=1, m} and a candidate object set O K, the following can be defined:That is, the K nearest neighbors for these single point queries are the union of the object regions of each query point relative to the same candidate object set O K. In other words, the object regions are additive.FIGS. 7A and 7B provide two different examples of the object range for multiple single point queries Q P= { Q 1= { p 1}, Q 2= { p 2}} on the candidate object set O K= { o 1, o 2, o 3}. As before, O K is a subset of the object set O S. As shown in FIG. 7A, for each of the sample points, the furthest object of the candidate object set may be different. In FIG. 7A, the farthest candidate object from viewpoint p 1 is candidate object o 1, and thus object region 700A of this viewpoint is the slice with center p 1 and the minimum distance from p 1 to o 1 as its radius. The farthest candidate object from viewpoint p 2 is candidate object o 2, and thus object region 700B of this viewpoint is the slice with center p 2 and the minimum distance from p 2 to o 2 as its radius. Accordingly, the K-NN's are nearest neighbors for these two sample points within the union of these two object regions 700A, 700B.As shown in FIG. 7B, for each of the sample points, the furthest object of the candidate object set may be the same. In FIG. 7B, the farthest candidate object from viewpoint p 1 is candidate object o 1, and thus object region 702A of this viewpoint is the slice with center p 1 and the maximum distance from p 1 to o 1 as its radius. The furthest candidate object from viewpoint p 2 is also candidate object o 1, and thus object region 702B of this viewpoint is the slice with center p 2 and the minimum distance from p 2 to o 1 as its radius. In this case, however, the minimum distance of p 2 corresponds to a point on o 1 other than the minimum distance of p 1, which defines the object region 702A.As before, the K-NN nearest neighbors for these two sample points are therefore these two object regions 702A, 702B.If two different candidate object sets O 1K and O 2K are used for two queries Q 1 and Q 2 the object ranges are still additive by definition:For example, FIG. 8 shows the object range of two point queries Q 1= { p 1}, Q 2= { p 2} on two different candidate object sets O 1K= { o 1, o 2, o 3} and O 2K= { o 4, o5, o6}. Here, the object range 800A of the retrieval point p 1 is the minimum distance to the farthest object in the candidate object set O 1K, which is the candidate object o 2 in this case. Similarly, the object region 800B of query point p 2 is the minimum distance to the furthest object in the candidate object set O 2K, which in this case is the candidate object o 6.As will be described in more detail below, in computing the object range for partitions of the space to be interrogated, it is important to select candidate objects that result in an object range of an appropriate size. If the object area is too large, this may result in an object set that is very large and requires a significant amount of processing power for the query. In such cases, it may be necessary to select another candidate object set, thereby providing a reduced object area that is more efficient to process.For example, as shown in FIG. 9A, if there are two object regions 900A-B calculated based on two different candidate object sets O 1K= { o 1, o 2, o 3} and O 2K= { o 4,05, o 6} for K=3, a new set of candidate objects may be selected to reduce the object region. As shown in FIG. 9B, if a new candidate object set is selected as O K= { o 3, o 4, o 5} the object area 902A of query point p 1 and 902B of query point p 2 are reduced, thereby reducing the combined object area (union of 902A and 902B) of both point queries Q 1= { p 1}, Q 2= { p 2}.Conversely, as illustrated by FIGS. 10A-B, re-selection of the candidate object set may result in an increased object range. FIG. 10A shows the object regions 1000A-B of two point queries Q 1= { p 1}, Q 2= { p 2} on two candidate object sets O 1K= { o 1, o 2} and O 2K= { o 3, o 4} for K=2. A new candidate object set may be selected as OK={o1, o3}, resulting in a larger object area than the 1002A-B union for both chunk queries Q 1= { p 1}, Q 2= { p 2}.Object Area for Multipoint QueryA multipoint query is a single query with a set containing multiple points. A group of dispersed points is an example of a finite multipoint set, and lines and polygons defined on X are examples of infinite multipoint sets.A multipoint query is actually a collection of multiple single point queries as described above, where all points are treated as belonging to only one query. In this regard, the K nearest neighbors for the individual points are accumulated and then re-ranked to return a single set of K nearest neighbors for the multipoint query.Accordingly, for a given multipoint query, Q={q i| i=1, m} may be defined as follows:In other words, KNN(Q,O S) can be derived from the collection of K nearest neighbors of all points in Q. FIG. 11 shows an example of the object range (1100A-B) of a multipoint query with two points Q={p 1, p 2} on the candidate object set O K= { o 1, o 2, o 3}. In this regard, the arrows extending from the sample points p 1, p 2 indicate which candidate object is used to provide the measurement of maximum distance.Extended Object Range in Multipoint ObjectsIf the candidate object set O K is a set of single point objects, for a set of query points Q={q i| i=1,m) (either as stand-alone points or as multipoint query) the following can be asserted:That is, for a given candidate object set of single point objects, these candidate objects are all included within the intersection of the object regions of the query points, as shown in FIG. 12, where all of the single point objects {o 1, o 2, o 3} are included within the intersection 1202 of the object regions 1200A and 1200B.However, this does not apply to multipoint objects. As discussed above, the furthest point on a multipoint object may be different for different queries (as shown in FIG. 7B ). To ensure coverage of the entire multipoint object, MaxIst is used instead of MaxMinIst to extend the initial definition of object range.Given an integer of 1 ≤ K ≤ n, a single point query Q = {q} and a set of objects O K= { O i| i = 1, K} ⊆ O S as candidate object set, then OR E( Q, O K) is defined as extended object range for Q{q} at k ≤ K with respect to O K as follows:FIGS. 13A and 13B illustrate the difference between the object range for a multipoint object described above and an extended object range as defined by [7] above. In FIG. 13A, the object range for two sample points is defined as MaxMinIst to the multipoint object o 1. That is, the object areas 1300A and 1300B of each of the interrogation points p 1 and p 2 are defined as the distance to the closest point of the object o 1 respectively. This is in contrast to FIG. 13B where the extended object areas 1302A and 1302B of each viewpoint p 1 and p 2 respectively are defined as MaxIst to the multipoint object o 1, i.e., the distance from each viewpoint to the furthest point of the object o 1.Accordingly, the following statement can be made:It is therefore apparent that OR(Q,O K) E( OR K). A byproduct of this extended object range is that the previously defined extended distance metrics, MaxIst and MaxMinIst, can also be used as a metric for performing an ANN query in addition to the conventional MinIst metric for K-NN queries.The following statement can also be made for a multipoint query:Accordingly, the statement [6] can also be extended to cover multipoint objects:Scalable ANN Object AreaFor each subset Q i ® Q as a new query, it is clear that the K nearest neighbors for Q i would be in the object range of Q. That is, the object range for a subset region of X can be calculated and the K nearest neighbors for all queries falling within that region are in the calculated object range. This therefore provides a solution to the scalable ANN problem.As already mentioned, the query space is a subset of the relevant metric space. All queries are defined in the query space. Given C={c i| i=1, n}, where C is a cover or partition of the query space on which the set of queries Q S is defined, then each subset c i may be assigned a candidate set of objects O iK containing K objects from the object set O S and an object range for each c i may be calculated as OR(c i, O iK). In this regard, a "cover" represents a collection of subsets of the query space whose union constitutes the entire query space. In a coverage, two subsets may overlap (i.e., they contain some of the same data points that are not on their boundaries). Alternatively, a partition forms a non-overlapping coverage of the query space. The following discussion relates to a "partition" as a subset of the query space generated by performing a coverage or partitioning process.The following statement can be made accordingly:That is, it is possible to precompute the object range for c i, i.e., OR(c i, O iK), and use it to retrieve O c as the set of objects from O S that intersects with the object range OR(c i, O iK) so that for each query in c i the K nearest neighbors are found in O C.Thus, ANN queries performed in c i may be processed independently of other portions of O S( i.e., O S- O C) making the ANN process truly scalable. An additional advantage of this approach is that the object areas calculated in advance can be stored together with the object data set and reused for another query set at a later time.Object Area for Spatial Data in Euclidean SpaceAs will now be described, object ranges may be calculated as geometric entities for queries as line segments, triangles, or polygons given a Euclidean space as an instance of a metric space with a Euclidean distance as its distance metric. In this regard, it should be understood that spatial data such as geodata may be represented in Euclidean space.Object Area for Sample Points on a Line SegmentGiven two points p s and p e in metric space (X, d), then a line segment in X with the two points as endpoints can be defined as an infinite point set:Specifically, {p | p ≠ p s Λ p ≠ p e} are the inside of L. It is worth noting that this is a definition of a line segment in generic metric spaces and is not necessarily limited to the Euclidean space.Given a candidate object set O K, which contains K objects from the object set O S then for the Euclidean distance, the object range for a point p on L, OR E( p ∈ L) can be defined as the slice with the center at point p and with the distance from point p to the intersection of the boundary of OR Es and OR Ee as its radius, so that the following statement can be made:That is, as illustrated in FIG. 14, the object region 1400 of a point p on the line segment L, OR EP, is included within the union of the extended object regions 1402A and 1402B (i.e., the extended object regions OR Es and OR Ee) described above of the two end points p s and p e of the line segment L. On the other hand, OR Ep contains the intersection of the two object regions 1402A and 1402B.According to

[10] , since the candidate object set O K ⊆ Ee), (OR Es, OR it can be concluded that O K ⊆ OR Ep, and as a result, OR Ep is the object region 1400 for each query point p along the line segment L. Accordingly, it follows:That is, KNN for each point p at L is within the union of the object ranges of the two endpoints of L.Object Area for Query Points in a TriangleGiven three points p 1, p 2 and p 3 in X that are non-collinear (i.e., d(p 1, p 2) + d(p 2, p 3) > d(p 1, p 3)) then a triangle T(p 1, p2, p3) can be defined on X as follows:Specifically, the line segment between each of the three points, i.e., L(p 1, p 2), L(p 2, p 3), L(p 3, p 1), forms the boundary of the triangle, and the remainder forms the interior. This is also a definition of a triangle in generic metric spaces.Similarly to the case of the line segment described with reference to FIG. 14, for a candidate object set O K, which contains K objects from the object set O S for the Euclidean distance, the object region OR E( p) can be defined as the slice having the center at a point p (where p is a point within the triangle) and the largest distance to the three intersection points of the boundaries of OR E1, OR E2, OR E3 as its radius as follows:That is, as illustrated in FIG. 15, the object region 1500 of a point p within the triangle T(p 1, p 2, p 3) is the union of the extended regions 1502A, 1502B, and 1502C of the three vertices (i.e., the points p 1, p 2 and p 3). Accordingly, for each query point within the triangle, its K nearest neighbors are found within the object range 1500 of the triangle. This principle can therefore be extended to a polygon with any number of vertices.Object Area for Interrogation Points in a PolygonFor a polygon P (p 1, p 2,..., p m), which is formed by merging two or more triangles with common edges, the following applies:That is, similar to the example described with reference to FIG. 15, the object range of a polygon is the union of the extended object ranges of all its vertices. Accordingly, for each query point within the polygon, its K nearest neighbors are found within the object range of the polygon.Accordingly, the statement

[22] provides a method for calculating the object areas for queries in a polygonal region in the query space.Some additional properties of the object range of polygons and strings are listed below, which can be advantageous for practical implementations, in particular because they allow easier calculation of the object range. If CH(P) is the convex hull of a polygon P, then the following can be defined:That is, the object region of a polygon is contained within the object region of its convex hull.For a line string LS(p 1, p 2,..., p m), which consists of a plurality of line segments, the following can be defined:That is, the object range for query points on a line string is included within the union of the object range of its vertices as well as the object range for points on its convex hull.K-NN for Point Set QueriesThe statement [5] states that for a multipoint query Q, its K-NN is the union of the K-NN of all its constituent points, which lie in the union of the object regions of these points.Given a polygonal region P in a sample space with K candidate objects, its object range may be defined as OR E( P). Let a multipoint query be given as Q ⊆ P:That is, the K-NN of Q is within the object range of P. Here, Q may be a collection of discrete points, a line string or a multi-line string, or a polygon or a multi-polygon.If Q does not fall entirely within a polygonal region, for example Q=U ( ≅ (Q, P 1), ≅ (Q, P 2)) extends across P 1 and P 2, then the following may be defined:That is, the K-NN of Q lies in the union of K-NN object sets of their intersection sets with P 1 and P 2. This can be extended to cases where Q extends across multiple polygonal regions.Method for Preprocessing Spatial Data for K-NN QueriesThe method for preprocessing spatial data for K-NN queries will now be described with reference to FIG. 1. As already mentioned, the first step 1.2 of preprocessing is to partition (also referred to as "coverage", as described above) the sample space (i.e. the region of metric space in which samples are to be made) comprising a spatial dataset or part of a spatial dataset received from a data storage system 100, and assign candidate objects to each partition K. In the following examples, it is assumed that the query space and the object space are identical (i.e., queries are defined within the same spatial extent of the object set). However, it should be appreciated that the query space and the object space may not be identical and may be separate, as will be described in more detail below.As already mentioned, the object range can be calculated for a polygonal region in Euclidean space. By considering a polygonal region as a partition in the query space, an object area for each partition may be calculated, as described in more detail below, such that queries that fall within different partitions may be processed in parallel.The object region of an apex is a slice that can be precisely represented by a mathematical equation, but in a computer system this is not the case, and so in practical implementations a polygon (e.g., a square or an octagon circumscribing the slice) is normally used.The partitioning scheme used to partition the query space is selected based at least in part on the nature of the object set, for example, the distribution and number of objects within the object data set, as well as the number of distributions of queries (if known). Given a partition of a predefined size, it is preferable that its object area be relatively small in order to retrieve fewer redundant objects and improve query performance.By definition, the size of the object range slice for each vertex depends on the MaxIst to the candidate object set. Generally, the overall size of the object area for the partition is minimized when the candidate object set is compactly clustered and closer to the center of the partition. Ideally, the sample space is partitioned such that there are exactly K candidate objects in each partition that can be assigned to each partition without additional process, but in practice object selection and / or reallocation may be required.One approach might be to randomly associate objects with each partition K; however, this would result in impractically large object areas that are very difficult, if any, to process by a computer system. It is therefore better to assign objects by searching or intersecting the object set proximally with the partitions to obtain a more compact cluster of objects near the center of the partition and thereby minimize object area.For a uniformly distributed object set with M objects, a single-stage regular grid of at most M / K cells generates partitions, each containing approximately K objects. If more than K objects are allocated to a cell as a partition, the K objects closest to the center of the cell may be selected. If fewer than K objects are in a cell, additional objects from neighboring cells may be assigned to the cell. Such an assignment requires a search structure to find adjacent cells. For a regular grid, such a search structure can be efficiently implemented when the number of objects and partitions is relatively small.For non-uniform object distribution, which is often the case when processing geodata, a quadtree (in the case of a 2D space) can be used to generate partitions hierarchically. Further details for handling a large data set are provided below.Both of the aforementioned schemes are space-based regular partitioning. Alternatively, object-based irregular partitioning may be used. One approach is to first perform a clustering process on the object set to create clusters of at least K objects and then create approximated Voronoi plots on the clusters as a partition. Here, approximation refers to the fact that no exact Voronoi diagram is required and the diagram boundaries can be greatly simplified to reduce the number of vertices on the boundary of the partitions.A practical method for such a clustering process in Euclidean space is to build Delaunay triangulation on object points (using centroids for multipoint objects) and treat the triangulation as graphs as shown in FIG. 16A, forming edges between groups of object points to form triangles. The longest edges are then recursively removed as shown in Figures 16B and 16C, typically until another distance results in a subgraph having less than K object points as nodes.Each remaining subgraph is then a cluster for partitioning. The original delaunay can then be used to generate the approximate Voronoi diagram of the clusters, as shown in Figure 16D. It should be understood that although FIGS. 16A-D illustrate a method in which the object points are clustered into trigroups (i.e., K=3), any suitable clustering may be used.If a partition contains more than K objects after the initial object assignment, the K objects closest to the center of the partition are selected as the candidate object set for that partition.If there are less than K objects in a partition, adjacent partitions are searched to find more objects until the partition is assigned K objects. In this regard, an object could be part of the candidate object set for more than one partition, and therefore the objects from adjacent partitions are not "re-allocated" but "doubly allocated". The information about the neighborhood of partitions may be obtained during the creation of the Voronoi diagram and stored along with the diagram to facilitate the reallocation process.Handling of a very large set of objectsThe approaches described above are generally effective for small data sets, however, partitioning of a query space becomes substantially more complex when very large object sets are involved, which is often the case with spatial data such as geodata.In such cases, if a small number of large partitions are generated, each partition corresponds to a larger subset of queries and a larger object range, thereby retrieving a larger set of objects during preprocessing and / or for performing subsequent K-NN queries. The dual need for object and query storage space may well exceed the capacity of a processing unit in a parallel computing environment (e.g., a computing node).On the other hand, if a large number of small partitions are created, this could result in a large amount of partitions that contain fewer than K objects. Thus, a search structure for finding adjacent partitions must usually be maintained to ensure that each partition is assigned K objects, which can also exceed the capacity of the processing unit if the search structure covers the entire object set.To eliminate the need to always maintain a search structure for all partitions, a top-down hierarchical approach for generating partitions is proposed, which will now be described with reference to Figs. 17A-B. Here, a quadtree (on a 2D spatial dataset) is used as an example to demonstrate the method.As shown in FIG. 17A, an initial partitioning of the spatial extent of the entire object set (i.e., the area covered by the object set), {o i|i=1, 6}, is first performed. The number of partitions should be well maintained within the capacity of the processing unit. In this example, the object set is partitioned into four initial partitions 1700A-D. One or more of the objects are then assigned to different partitions, first after inclusion (i.e., objects contained within the partition) and then neighbor (i.e., the objects are contained in adjacent partitions) until all partitions 1700A-D have at least K objects associated therewith. In this regard, it should be understood that K may be any number required. In the present example, if K=1 then, except for partition 1700A, all of the initial partitions include at least one object. A search structure is then required to manage information about partitions adjacent to each of partitions 1700A-D. For partition 1700A, adjacent partitions 1700B-D are recognized from the search structure and objects in these adjacent partitions are retrieved. Since the object o 1 among these fetched objects is the object closest to the partition 1700A, it is assigned to the partition 1700A due to its proximity. Because the number of partitions is limited at the current level, the size should be within the capacity limit and the memory it occupies is released immediately after the object assigned to partition 1700A.Next, as shown in FIG. 17B, the same process is re-applied as necessary to create partitions as new partitions and assign objects from the parent partition accordingly. Whether a partition should be further partitioned may be based on such criteria as the minimum number of objects in the partition and / or the spatial extent of the partition. For example, if we set the threshold for further partitioning to 3 or more objects in a partition, as shown in FIG. 17B, partition 1700D is further partitioned into four further partitions 1702A-D, but partitions 1700A-C are not further partitioned because they do not exceed the threshold of 3 or more objects. Objects o 4, o 5 and o 6 of partition 1700D are then assigned to further partitions 1702A, 1702B and 1702C, respectively, due to their inclusion within these further partitions. Because the other partition 1702D itself does not contain objects, the nearest object o 6 is also assigned to that other partition 1702D due to its proximity using a new search structure built on partitions 1702A-D. As new partitions are created, their parent partition (e.g., partition 1700D) is removed from the partition list and any memory space occupied by the parent partition is released.This process is then repeated recursively until further partitioning is no longer required according to the preset criteria.Although the construction of a search structure for adjacent partitions may still be required to partition an individual partition, it is not necessary for the entire set of objects using this approach. Consequently, the risk of an oversized search structure is eliminated.During this process, intermediate partitions may have much more than K objects associated with it, in which case these intermediate partitions are further subdivided and the objects redistributed to the new subdivided partitions. For an intermediate partition having only K objects associated therewith, it may still be necessary to create further partitioned partitions due to such conditions as the maximum extent of a partition. In this regard, if a partition is spatially too large, this may result in too many sample points being within the partition, which may then overprove the processing capabilities of a compute node within the distributed or parallel computing system. In such cases, the same K objects may be assigned to each of the partitioned new partitions. In such cases of partitions, a search structure would not be necessary because all of the new partitions have the same K objects and therefore, when querying one of the new partitions, it would not be necessary to search for the adjacent partitions because they would output the same objects.The hierarchical partitioning process can also be applied to irregular partitions with a multi-level sampling scheme. In this regard, a small random sample is selected from the entire object set and an initial partition is built on the sample object set (e.g., using the Voronoi diagram). For each of the generated partitions in the form of irregular polygons, the sampling process is recursively repeated on all objects in a partition until the entire sample space is partitioned with less than K objects in each partition.Often, the distribution of the object set is non-uniform, but still overlaps largely with the interrogation space. However, there are extreme cases where the interrogation space and the object space do not intersect each other at all. An example of such a case is when the object set comprises marine polygons (an upstream zone of a marine region divided into multiple polygons) while the interrogation sites comprise features on land (e.g., residential buildings).In such cases, the hierarchical partitioning method is used. Otherwise, a conventional single-stage partition scheme would spend most of the time in performing neighborhood searching because most of the initial partitions (i.e., partitions of the country) do not contain overlapping objects (i.e., marine polygons).Once the search space is partitioned and K objects are allocated for each partition, at step 1.4, the object area for each partition polygon is calculated using, for example, one of the methods described above. In this regard, the method employed depends on the objects within the candidate object set. In this regard, considering a partition as an infinite point set, it is not possible to calculate the object area for each point in the partition. How the object area is calculated therefore depends on the actual metric space that is involved. In the two-dimensional Euclidean space, the object range of a polygon partition can be calculated by merging the object ranges of the vertices of the polygon boundary (the number of which is finite).For example, as shown in FIG. 18, a spatial dataset (i.e., the sample space) may be partitioned using a raster system that includes cells of a given size. In the context of geodata, for example, the grid cells can represent a 1 km x 1 km area. FIG. 18 illustrates a partition 1800 as an example, where the partition 1800 includes four vertices 1802A-D. At step 1.2, the partition 1800 has been assigned candidate objects o 1, o 2 and o 3 where the candidate objects o 1, o 2 and o 3 are polygons represented by multiple points (i.e., the vertices of the represented polygons and the points along the line segments between these vertices). The object area (represented by the area enclosed by circles 1804A-D) of each vertex 1802A-D is then calculated based on the maximum distance between each vertex 1802A-D and the candidate objects o 1, o 2 and o 3 where the maximum distance defines the radius of the object area 1804A-D. For example, the maximum distance from the vertex 1802A to the candidate objects o 1, o 2 and o 3 is the distance from the vertex 1802A to the farthest point of the object o 2. This distance thus provides the radius of the object region 1804A for the vertex 1802A. A similar calculation is thus performed for each of the vertices 1802A-D, where the object region of the entire partition 1800 is the union of these four object regions 1804A-D. That is, the object region of partition 1800 includes all of the objects contained within object region 1804A-D. For example, the partition's object area includes the objects o 4,o5, o 6 and o 7 as well as o 1, o 2 and o 3. It should be appreciated, however, that other objects may be included within object regions 1804A-D, but are not shown here for simplicity. It will also be appreciated that the boundary of the union of the object regions 1804A-D may also be simplified, for example, by using a circumscribed octagon.Then, at step 1.6, the preprocessed object area information for each partition is stored as data for subsequent use in K-NN searches in the data storage system 100, for example. In this regard, the object range information may include the calculated object range and data associated with the respective partition. The object range information may be used spontaneously to retrieve objects for the respective partition, ensuring that the K nearest neighbor of each query within that partition is included in the subset of objects retrieved for that object range. For example, referring to FIG. 18, the stored object area information may include the partition data (e.g., partition 1800) and the calculated object areas for each partition (e.g., object areas 1804A-D). Additionally or alternatively, the object set for the partition may be identified using the object range calculated in the pre-processing phase, and all retrieved objects may be stored with the object range information as object data. For example, referring to FIG. 18, all of the objects contained within object regions 1804A-D (e.g., objects o 1 through o 7) may be stored for use in subsequent K-NN queries.The preprocessing described above with reference to FIG. 1 supports k-NN queries from k=1 to K, where K is a positive integer given at the time of preprocessing. However, it should be appreciated that if k<K, performance is less effective due to additional objects involved to support a large K compared to an object range specifically calculated for a smaller k.One approach to solving this is to calculate multiple object areas (k=1, K) for each partition and store all of the calculated object areas with the partition data. Then, when a subsequent query is performed, as described in more detail below, the relevant object region is identified for the given k and then used to retrieve the optimal subset of objects for that k.An alternative approach is to compute multiple object regions (k=1, K) for each partition, retrieve an object subset using each object region, and store each object subset with the partition data. Each retrieved object may be labeled with the k associated with the object region from which that object was first retrieved (i.e., since some objects are retrieved for a plurality of k values). Then, when a subsequent query is performed, k q ≥ k can be used to filter out unnecessary objects. For example, if K=5 and k q= 2 only objects labeled 1 or 2 are retrieved.Method of Using Object Regions to Perform K-NN Spatial QueriesAs already mentioned and illustrated in Figure 2, the first step 2.2 in the method for performing K-NN spatial queries is to receive a request for performing a K-NN spatial query on the spatial dataset stored in the data storage system 100, where K nearest neighbors in an object set are to be calculated for the query set (i.e., a plurality of query locations). Although the following discussion, as already mentioned, relates to spatial data received from a data storage system 100, it should be understood that the query space may include any suitable type of metric data on which K-NN queries may be performed.At step 2.4, data is received from the data storage system 100 and used to partition the sample locations using the same partition framework as was used in preprocessing step 1.2. In this regard, the received data may include the spatial data to be interrogated (i.e. the interrogation space) and the previously stored partition data. It is understood, of course, that the partition data and the object area information described with respect to the preprocessing method shown in FIG. 1 may be stored on a storage means other than the spatial data set. In this regard, a query may overlap with more than one partition and thus be included in the query sets of multiple partitions. In such cases, the query is performed in each of these partitions and the results are aggregated and reprocessed. Further details thereof are provided below.At step 2.6, an object set for each partition is obtained based on the object area information stored above at step 1.8, which can be stored in the data storage system 100 or on any other storage means. As mentioned above, the object range information may include the object range that may be used to spontaneously identify an object set. Alternatively, the object range information may comprise a preprocessed object set associated with that partition.At step 2.8, for each query of the query set of a partition, a K-NN query may be performed on the retrieved object set for the given partition. In doing so, only the objects associated with a partition based on the object range need to be queried to find the K nearest neighbors of the queries contained therein, thereby avoiding the need to perform K-NN queries on the entire object set, thereby reducing the amount of processing power required to perform the K-NN query.As will be described in more detail below, the partitions may be distributed among the processors of a distributed or parallel computing system to perform the K-NN queries. By preprocessing the data in this manner, the K-NN query can be performed much more quickly over all of the query locations. The amount of data to be sampled by each processor (i.e., within the distributed or parallel computing system) is significantly reduced because only the objects within the object range of each partition need to be sampled, thereby making it possible to efficiently perform extensive K-NN samplings while at the same time ensuring an accurate set of results for each sampling.For queries spanning multiple partitions, for example using the statement

[27] above, the returned results are collated for output and all duplicated results from different partitions are removed. If more than K objects are left in the deduced object set, all objects are re-ranked according to their distance from the query and the closest K objects are selected as the final result for that query.That is, if the processing of two or more partitions results in more than K objects for a given query location, the distances of these objects are compared to find the actual K-NN objects for that query location.At step 2.10, the results of the spatial K-NN query are then output to the user. These results may be output to the user in any suitable form, such as a table format or a graphical format (e.g., as a map).FIG. 19 illustrates an example of a distributed computing system used to implement the methods described in detail above and reference should be made to the above when considering the various steps and processes described below.FIG. 19 illustrates a distributed computing system 100 that includes a server 110 in communication with a plurality of computing nodes 140A-C over a network 130 through a communication interface 112. The server 110 includes a processor 114 configured to perform computing operations and also in communication with a core server 120. The core server 120 executes various software-implemented modules that perform various tasks or provide specific data when needed by the processor 114. More specifically, it is a data storage system 122 that stores the object data set at which queries are to be performed. For example, the data storage system 122 may store spatial data and, more particularly, geodata. The data storage system 122 may also store partition data and object area data obtained during the preprocessing described with reference to FIG. 1, or alternatively, the data may be stored on any other storage means. A K-NN pre-processing module 124 may be configured to perform the necessary steps to pre-process the data for use in K-NN queries, as described above with reference to FIG. 1. When a K-NN request is received by the server 110 (e.g., via the network 330), a K-NN query module 126 may be configured to partition the query locations using the dataset and the partition data stored in the data storage system 122, and obtain the object set for each partition using the object range information stored in the data storage system 122, as described above with reference to steps 2.4 and 2.6 of FIG. 2. It is also understood that the preprocessing described with reference to FIG. 1 and / or the steps 2.4 and 2.6 described with reference to FIG. 2 may also be performed by the compute nodes 140A-C. For example, the compute nodes 140A-C may be configured to compute the object range information for each partition. Similarly, compute nodes 140A-C may be used to partition the query locations and obtain the object set for each partition using the object range information.Once the query locations have been partitioned and the object set is identified for that partition, the server 110 is configured to send the query data and object data associated with one or more partitions to a compute node 140A-C for processing via the network 130. In this regard, each computing node 140A-C may include a memory 142A-C or other non-transitory device storing computer readable instructions that, when executed, cause a processor 144A-C to perform a K-NN query in the one or more partitions received from the server 110. Once the K-NN query is performed, the results of the K-NN query are returned to the server 110 for collation and output to the user.Although three compute nodes 140A-C are illustrated, it should be appreciated that the distributed computing system 100 may include any number of compute nodes. The partitions are then sent to as many compute nodes 140A-C as required to perform the K-NN query over the entire dataset. In this regard, it should be appreciated that each compute node 140A-C within the distributed computing system 100 may receive multiple partitions for processing, the partitions being processed by the respective compute node 140A-C in sequence.In addition, although the K-NN preprocessing module 124 and the K-NN query module 126 are shown as being provided on the same core server 120, it should be appreciated that the preprocessing of FIG. 1 may be performed on a separate computing system, the results then being sent to the core server 120 for storage in the data storage system 122, or in response to a request from the server 110 when a K-NN query request is received.It will also be appreciated that the present invention is implemented on a parallel computing system in a similar manner. In such cases, the compute nodes 140A-C are replaced by a single compute entity that includes multiple processors. It will be understood that the K-NN queries are performed by a plurality of processing means, wherein the processing means comprises the processors of a plurality of computing nodes connected via a network (i.e., a distributed computing system) or the processors of a single computing system (i.e., a parallel computing system).A number of examples of the present invention in use will now be described.Example 1Referring now to FIGS. 1 and 2, an example is described wherein both the object set and the query set include a plurality of geodata points.In this example, the object set includes data points representing zip codes in the United Kingdom (over 1.73 million). Accordingly, in this example, the query space and the object space comprise geodata representing the United Kingdom Land Mass.For preprocessing the geodata, they are first partitioned, each partition being assigned K candidate objects (step 1.2).For example, the geodata (i.e., the sample space) may be partitioned using a 1 km x 1 km square cell grid system, as data points of the zip codes are typically relatively evenly distributed. Thus, a partition as a grid cell takes the form of a square having four vertices (i.e., vertices). Because only geodata related to GB country is required, all grid cells that do not overlap with GB country polygons (e.g., marine polygons, land polygons associated with other countries) are omitted.The object set is spatially linked to the grids to give each partition (i.e., a grid cell) an initial object set for object range computation. For example, based on there typically being no more than 3 zip codes within an area of 1 km 2 of a densely populated city, each partition can be assigned K=3 candidate objects. For all partitions where there are less than K objects, an extended ring search is performed to obtain additional objects from adjacent partitions until K is reached for each partition. A search structure is maintained for the relevant partitions to ensure efficient retrieval of neighboring partitions.Then, the object area is calculated for each partition (step 1.4). For example, the K objects closest to the center of the grid cell are selected to calculate the object area for each partition. In this regard, the object areas of a vertex of the grid cell polygon are calculated as the slice with the center at the vertex and the MaxIst from the vertex to the furthest object in the K objects as the radius. The object area of a grid cell is thus the union of the object areas of the four vertices, as described above.For each partition, the object range information and partition geometry are stored for use in subsequent K-NN queries (step 1.6), where the object set includes GB zip codes.Then, when a request is received (step 2.2) to find the closest two zip codes (i.e., k=2) to each address in United Kingdom (i.e., each interrogation location is a data point representing addresses in United Kingdom, which corresponds to about 40 million interrogation locations), the interrogation locations are partitioned using the same partitioning scheme performed during preprocessing (step 2.4). That is, the geodata is partitioned again into 1 km x 1 km square cells, each partition having one or more query locations.The object range information calculated at step 1.4 is then retrieved and used to obtain the object set for each partition (step 2.6). In this regard, all data points representing a zip code and intersecting the object region geometry are retrieved to form the object set for that partition.As previously described, all query sets and the associated object sets of the partitions may then be transmitted to a plurality of distributed compute nodes or a parallel computing system where the K-NN query is performed in each respective partition (step 2.8) to find the 2 closest objects (i.e., zip codes) for each query location (i.e., address) within the partition.The results of the K-NN query are then output to the user in a table or other visual representation (e.g., a map) (step 2.10).By preprocessing the geodata in this manner, the K-NN query can be performed much more quickly over all of the query locations. The amount of data to be sampled by each processor (i.e., within the distributed or parallel computing system) is significantly reduced, thereby allowing extensive K-NN queries to be performed quickly (on the order of minutes) and without the need for significant processing power, while simultaneously ensuring an accurate set of results for each query.Example 2An example is now described wherein both the object set and the query set comprise a plurality of geodata polygons (i.e., comprise multiple data points).In this example, the object set includes polygons representing a plant ground covering surface (e.g., fields, parks, grass surfaces, etc.) in the United Kingdom (approximately 150,000).As before, the geodata (i.e., query space) is first partitioned, with each partition assigned K candidate objects (step 1.2).For example, the geodata may again be partitioned by a 1 km x 1 km square cell grid system. The object set is spatially linked to the grids to give each partition (i.e., a grid cell) an initial object set for object range computation. For example, each partition may be assigned K=5 candidate objects.Then, for each partition, the object area is calculated for each partition (step 1.4). For example, the K objects closest to the center of the grid cell are selected to calculate the object area for each partition. In this regard, the object ranges for a vertex of the grid cell polygon are calculated as the slice with the center at the vertex and the MaxIst from the vertex to the furthest object in the K objects as their radius. The object area of a grid cell is thus the union of the object areas of the four vertices, as described above.For each partition, the object range information and partition geometry are stored for use in subsequent K-NN queries (step 1.6), where the object set comprises polygons of a plant ground covering surface.If a request is then received (step 2.2) to find the nearest three plant ground covers (i.e., k=3) to each building in the United Kingdom (i.e., each query location is a polygon representing a building, which corresponds to approximately 14.5 million query locations), the query locations are then partitioned using the same partitioning scheme performed during preprocessing (step 2.4). That is, the geodata is partitioned again into 1 km x 1 km square cells, each partition having one or more query locations.However, one of the problems with queries that include polygon query locations is that the object range computed for a partition supports only queries within the partition, while polygon query locations extend beyond the partition and may intersect with multiple adjacent partitions.One approach to handling such a situation is to assign a unique identifier for each query and spatially link the query locations to the partitions to assign query locations for each partition, where a polygon query locations are linked to multiple partitions, for example, in the case where they intersect the geometries of multiple partitions.As before, the object range information calculated at step 1.4 is then retrieved and used to obtain the object set for each partition (step 2.6), the query set and associated object set of each partition then being transmitted to a plurality of distributed compute nodes or a parallel computing system to perform the K-NN query in each respective partition (step 2.8). Using this approach, multiple sets of results are returned for one query location for some polygon query locations, each set of results reflecting the K-NN query in a specific partition and the object set for that partition.Accordingly, the results are first processed to remove all duplicated results (i.e., the same query object pair). The results are then grouped using the query identifier and the distances between each pair of query location and object to re-rank the object to get the K-NN for each query location. That is, by using the query identifier, it becomes possible to identify all results that are associated with the same query location but have been processed as part of different partitions. Each result set for each query location may thus be compared to remove all duplicates and their distances ranked to yield the final set of K-NN objects. For example, each query location processed as part of two different partitions may generate a first set of K objects comprising object 1, object 2, and object 3, and a second set of K objects comprising object 1, object 2, and object 4. These two sets of results may then be compared to remove duplicate objects 1 and 2, and then the distances of objects 3 and 4 may be compared to determine which of the third closest neighbor is to the query location.The results of the K-NN query are then output to the user in a table or other visual representation (e.g., a map) (step 2.10).Performing K-NN Queries on a NetworkThe following discussion provides details of how the invention described herein can be used to process large scale network K-NN queries.A network of nodes and links may be shown as a graph. The terms network, node, and link may be considered graph theory as equivalents to graph, vertex, and edge.A network has a natural metric of shortest path distance between any two points in the network. In practice, however, it is common for the path to be directed, i.e. d(a,b)≠d(b,a), which violates one of the basic characteristics of the metric space. Initially, d(a, b)=d(b, a) is assumed and the directional topic is treated later.The Network K-NN problemGiven a network G(N,L) with N as node set and L as link set, N° ≅ N as object node set and Q° ≅ N as query node set, then for each q ∈ Q°, the K nearest neighbors in N° are determined by the shortest path distance. A node may be an object node or query node, or both an object node and a query node.A network may not necessarily be fully connected. A path from one node to another node may not be present in the network. In such cases, the network may be divided into multiple components (also referred to as connected components). Each component is fully connected as a sub-network, but there is no connection between any two components. The discussion below does not require a network to be divided into components, but it can be assumed that a component contains at least K object nodes, although cases with fewer than K object nodes can also be easily handled.It is assumed that all the interrogation sites are nodes in a network. In practice, however, they could also be points or intervals on the links. However, such cases may be converted into the node case. If a link 1 with end nodes n s and n e for each location p is 1, the following statement can be made:That is, the K-NN for a location on a link may be derived from the K-NNs for the two end nodes of the link. This also applies to intervals on a link.Object Area for a Network NodeGiven a query node n q and a set of object nodes N O_K, then the object area can be similarly defined as described above. The following definitions are used throughout the following discussion:G. Nodes: Node Set of Network GG. Links: Link set of network GSD(n 1, n 2): the shortest path distance from a node n 1 to a node n 2SD(n,1) : the smaller value of shortest path distance from node n to the two end nodes of link 1Node(L): all nodes connected by links in the link set LLink(N): all links connected to nodes in node set NG.BFS_KNN(n K): the sub-network generated by a width search of node n until K next nodes are found or the entire network has been searched. It contains the shortest paths from the node to the K object nodes as well as other paths sought in the process.The object range of a query node n q is defined with respect to the object node set N O_K as follows: wherein L OR= { 1 | SD (n q, 1) ≤ sup (SD (n q, n ∈ N O_K)} and N OR= Node (L OR)That is, the graph of all links within the maximum shortest path distance from n q to nodes in N O_K and all nodes on these links. Here, it is assumed that n q and N O_K are located in the same component so as to be connected.A great difference between a network and the Euclidean space is that the network is discrete. In general cases of a network having multiple components, it is not ensured that a node and a randomly provided object are connected. On the other hand, the number of paths between a query node and an object node is finite and nodes on the path are mutually dependent. For these reasons, the object area of a network node may alternatively be defined as follows:That is, the candidate object set is not provided but recognized by a width search process. Indeed, if the K-NN object nodes are known for the query node and definition

[30] is applied, the same sub-network is found.Network Partition and Border NodesA network G(N,L) can be divided into several sub-networks {G i( N i, L i) |I= 1, n}.FIG. 20A illustrates a first network 2000A including a plurality of nodes n 1-8 with links 1 1-11 therebetween. FIG. 20B illustrates a conventional approach of partitioning the network into two sub-networks 2002A-B with a partition boundary 2004. Specifically, the nodes n are 3-7 boundary nodes that are nodes of links that connect two sub-networks. The other nodes in the subnetwork are internal nodes. Links connecting the boundary nodes in two sub-networks, i.e. 1 5, 16 and 1 9, are considered boundary links. These boundary links are not included in any of the sub-networks partitioned by the conventional method, as shown in FIG. 20B.For practical reasons, which will be discussed in more detail, it is sometimes helpful to include the boundary links in the sub-networks, as illustrated in FIG. 20C. In addition, there may be cases where a boundary node occurs in two sub-networks as illustrated by FIG. 20D.It is therefore clear that the boundary nodes "shadow" the internal nodes of the subnetwork.Thus, it can be said that the one path from n int\, an internal node of a sub-network, to a node n ext in another sub-network passes at least one boundary node n bnd. If the path is the shortest path between n int and n ext it overlaps the shortest path between n bnd and n ext.Indeed, a path to another internal node may also pass a boundary node of the sub-network.Object Area for a Sub-NetworkGiven a sub-network G i( N i, L i) of a network G(N,L) with N iN as its boundary node set and N O as its object node set, an object area for a sub-network is defined as follows:That is, the object area of a sub-network is a network that is the union of the sub-network and the object areas of all its boundary nodes. Here, the merging operation merges node sets and link sets of two or more sub-networks to form a new network.The following is then defined for the object set N O N:That is, for each query node in the sub-network, its network K-NN can be found in the object area of the sub-network as defined in

[31] .Based on

[30] , the object area for a sub-network can be further simplified. As shown in FIG. 21, if a K-NN object node (n o) for a boundary node (n bnd) is outside the sub-network 2100, only the nodes (i.e., n 1) and links on the shortest path (i.e., links 1 1 and 1 2 from n bnd to n o) to the object node n o need to be included in the object area for the sub-network 2100, and all other nodes and links detected during the BFS search may be omitted.As mentioned above, multiple candidate object sets may be used to create a compact sub-network object area (actually one set per boundary node). This is possible primarily due to the discrete and finite nature of networks.The use of the width search implies that, depending on the partitioning strategy chosen, efficient access to the entire network may be required during the pre-processing phase. In cases where there are less than K object nodes in a component, the entire component is searched.The object region of a partitioned sub-network is a discrete and finite structure with a limited number of nodes. Consequently, it is possible to calculate and store the K-NN for all nodes in the partition in advance. At the query time, queries on nodes may be answered immediately; queries associated with locations on a link may also be answered efficiently using

[28] (i.e., via the K-NNs of the two nodes of the link).As mentioned above, the discussion of these sections assumes that all links are omnidirectional (and, as a result, the metric space characteristics are satisfied). In addition, all objects and queries are on existing nodes in the network, and thus it is possible to partition the network to create sub-networks without boundary links (as shown in FIG. 20D ).Example 3 - K-NN in a Spatial NetworkA spatial network is a graph whose nodes and links are point sets with locations defined in coordinate systems in Euclidean space.Thus, these links and nodes can be selected by space queries.Similar to the foregoing, a K-NN problem of a spatial network is defined as follows: Given a network G(N,L) with N as a node set and L as a link set, N O ≅ N as an object set and Q={q i ∈ 1 j| q i ∈ Q, 1 j ∈ L} as a query set in the form of a set of locations on L, then for each q ∈ Q, the K nearest neighbors in N O are determined by the shortest path distance.By definition, each query location q is not necessarily on a node. The reason why locations on links are used as query locations rather than nodes in a network is to better support the spatial partition of networks as well as queries with arbitrary spatial locations not on existing nodes in the network.An example of such scenarios is a road network and address points. Address points are not in the network itself, but a location in the network may be assigned (e.g., by proximity) for each address. For the purposes of the following example, it is assumed that the assignment of each query location on the links is carried out in a separate process. Indeed, this mapping itself may be a nearest neighbor query to which the methods described herein may be applied.For preprocessing the spatial network as described with reference to Figure 1, the spatial network is partitioned, each partition being assigned K candidate objects (step 1.2).With the locations of nodes and links in a spatial network, it may be partitioned according to any spatial partition scheme (e.g., a regular grid), such as illustrated by partition 2200 in FIG. 22. For a given partition geometry, all nodes and links intersecting partition 2200 are collected. In this regard, the nodes of the collected links, even those outside of partition 2200, are also collected (FIG. 19 ).This also includes the case where both nodes of a link are outside the partition 2200, but the inside of the link intersects with the partition 2200. This case is due to the spatial intersection between partition and links.It will be appreciated that FIG. 22 shows only one partition 2200, but that there are other partitions adjacent thereto. It is therefore apparent that some nodes and links may appear in the sub-network from more than one partition.After the spatial network has been partitioned, with 2200 nodes and links assigned to each partition, the object area for each partition is calculated (step 1.4).As mentioned previously, if all boundary nodes are on the boundary of the spatial partition, definition

[32] may be applied directly. A simple solution to this is to add new nodes on intersections between boundary links (including the special case described above) and partition boundaries. This, however, involves a further modification of the original data set which is not always desirable.An alternative solution is to slightly increase the object area. Briefly, for nodes at a partition boundary, their object range is computed its object range; for a boundary link, the object range is computed for the node outside the partition; and for the special case where links intersect the partition but both nodes are outside, the object range is computed for both nodes.More specifically, for each partition, all overlapping nodes and links are identified to create the initial sub-network.The nodes for object area calculation are identified by one of the two methods described above, and the object area for each of them is calculated through a width search network search process.The calculated node object region is merged with the initial sub-network to form the final object region for the partition (in the form of a network).As before, the calculated object area for each partition can then be stored for use in subsequent K-NN queries (step 1.6). Alternatively, because the spatial network includes a discrete set of query locations and objects, the K-NN for all nodes within the partition may be precomputed and stored.For spatial networks, there are two options for storing the object area information. All links and nodes in the object area subnet can be stored along with the partition. Alternatively, due to the spatial nature of the network, the convex hull (or concave hull) of all nodes and links in the object area sub-network can be computed and the hull geometry stored with the partition. When a query is to be made, the hull geometry can be used to retrieve the nodes and links of the object area via the spatial query.A more extreme approach is to precompute the K-NN for all nodes included in the partition (e.g., using a Floyd-Warshall algorithm to determine the shortest path distance between all pairs of nodes in the object area sub-network). If only the identities of the K-NN object nodes are needed, the additional memory required is minimal and it is not at all necessary to store the object area at all.To process K-NN queries in a partition, the method described with reference to FIG. 2 is essentially used again.As before, the spatial network is partitioned using the same partitioning scheme as the pre-processing (step 2.4) and the stored links and nodes of the object area for each partition are retrieved (step 2.6). Alternatively, as described above, the hull geometry of the object region can be used to retrieve all links and nodes.A graph is created using the links and nodes retrieved for each partition, and a preferred shortest path algorithm is used to calculate the K-NN for each query location.If the K-NN is precomputed for all nodes, only the links intersecting a partition and the nodes of those links need to be fetched. Then, definition

[28] may be applied to get the K-NN for each query location associated with a link intersecting the partition.Directed Network LinksAlthough the discussion above refers to omnidirectional network links to satisfy the metric space property, this limitation can be relaxed for many applications that require shortest path distance in only one direction (i.e., from a query location to an object node).As shown in FIG. 23, where n k_s and n k_e are object nodes, link 1 (n s, n e) is a directed link (only from n s to n e). For a query associated with the link, its K-NN is equal to K-NN (n e) = n k_e, rather than being selected from the union of KNN(n s) and KNN (n e) because there is no path from the query location to n s without passing n e.

Claims

A computer-implemented method for performing K-nearest neighbor (K-NN) queries on a spatial dataset in a distributed or parallel computing system, the distributed or parallel computing system comprising a plurality of processing means and the spatial dataset comprising a query dataset and an object dataset, the method comprising: receiving instructions to perform a K-NN query on the spatial dataset to find a set of k-NN objects for a plurality of query locations of the query dataset, wherein k is an integer value greater than or equal to one; generating a plurality of partitions of the query dataset according to a first partition scheme; determining a set of objects to query from the object dataset for each partition based on preprocessed object range information associated with the partition, wherein the preprocessed object range information is determined using the first partition scheme and K is a predetermined number of candidate objects assigned to each partition, wherein K is an integer value greater than or equal to the integer value of k; distributing the plurality of partitions and the respective sets of objects to query between the plurality of processing means to perform the K-NN query, wherein each processing means processes one or more partitions to determine a set of k-NN objects associated with each query location of a partition; receiving one or more sets of k-NN objects from each processing means; and collating the one or more sets of k-NN objects from each processing means for output.The computer-implemented method of claim 1, wherein the plurality of partitions are generated such that each partition comprises at least one query location, optionally wherein generating the plurality of partitions comprises receiving pre-processed partition data for the query dataset, wherein the pre-processed partition data comprises the plurality of partitions.The computer-implemented method of claim 1 or 2, wherein the preprocessed object area information comprises the set of objects to query for each partition.The computer-implemented method of claim 1 or 2, wherein the preprocessed object area information comprises an object area for each partition, the object area comprising one or more surfaces of the spatial dataset, each surface enclosed by a circle having a radius calculated based on a maximum distance between a vertex of a boundary of the partition and K candidate objects assigned to the partition.The computer-implemented method of claim 4, the method further comprising preprocessing the spatial dataset to determine the object range of each partition, the preprocessing comprising: identifying each vertex of the boundaries of the partition; assigning K candidate objects to the partition; calculating an area enclosed by a circle having a radius calculated based on the maximum distance between the vertex and the K candidate objects for each vertex of the partition boundary; and determining the object range of the partition based on a union of the area calculated for each vertex of the partition boundary, optionally wherein determining the set of objects to query for each partition comprises identifying the objects within the area calculated for each vertex of the partition boundary.The computer-implemented method of any preceding claim, wherein collating the one or more sets of k-NN objects comprises: identifying a query location processed within two or more partitions such that two or more sets of k-NN objects are received; removing all duplicated k-NN objects contained within the two or more sets of k-NN objects; and rows of remaining k-NN objects depending on a distance from the query location and each k-NN object, thereby providing a final set of k-NN objects to the query location.The computer-implemented method of any preceding claim, wherein at least one of the following applies: (i) the first partition scheme comprises one of the following: a raster system, a quadtree, or a Voronoi diagram; (ii) the spatial dataset comprises geodata representing a geographic region; (iii) the query dataset and the object dataset comprise one or more of the following: data points, line segments, and polygons.A system comprising: a processor; and a computer readable medium storing one or more instruction(s) configured to, when executed, cause the processor to perform the method of any preceding claim.The system of claim 8, wherein the system further comprises a distributed computer system comprising a plurality of compute nodes, wherein the plurality of partitions are distributed between the plurality of compute nodes, or wherein the system further comprises a parallel computer system comprising a plurality of processors, wherein the plurality of partitions are distributed between the plurality of processors.A computer-implemented method for preprocessing a spatial dataset for use in K-nearest neighbor (K-NN) queries to be performed in a distributed or parallel computing system, the spatial dataset comprising a query dataset and an object dataset, the method comprising: generating a plurality of partitions of the query dataset according to a first partition scheme; assigning K candidate objects from the object dataset to each partition, wherein K is an integer value greater than or equal to one; determining an object region for each partition, the object region of each partition comprising one or more faces of the spatial dataset, each face being enclosed by a circle having a radius calculated based on a maximum distance between a vertex of a boundary of the partition and the K candidate objects; and storing object region information for use in K-NN querying the spatial dataset, wherein the object region information comprises at least the object region determined for each partition.The computer-implemented method of claim 10, wherein determining the object range for each partition further comprises: identifying each vertex of the boundaries of the partition; calculating an area enclosed by a circle having a radius calculated based on the maximum distance between the vertex and the K candidate objects for each vertex of the partition boundary; and determining the object range of the partition based on a union of the area calculated for each vertex of the partition boundary.The computer-implemented method of claims 10 or 11, wherein assigning K candidate objects comprises assigning a predetermined number of candidate objects to each partition based on an inclusion within the partition and / or a neighborhood of the partition.The computer-implemented method of any of claims 10 to 12, wherein storing object range information further comprises storing the plurality of partitions as partition data, and optionally wherein storing object range information further comprises storing object data for use in K-NN queries, wherein the object data comprises one or more objects contained within an area of the spatial dataset defined by the object range of each partition.The computer-implemented method of any of claims 10 to 13, wherein the method further comprises determining a plurality of object regions for each partition based on two or more sets of K candidate objects for each partition, wherein each set of K candidate objects comprises a different number of objects.The computer-implemented method of any of claims 10 to 14, wherein at least one of the following applies: (i) the first partition scheme comprises one of the following: a raster system, a quadtree, or a Voronoi diagram; (ii) the spatial dataset comprises geodata representing a geographic region; (iii) the object dataset comprises one or more of the following: data points, line segments, and polygons.A system comprising: a processor; and a computer readable medium storing one or more instruction(s) configured to, when executed, cause the processor to perform the method of any one of claims 10 to 15.