2,331
Views
2
CrossRef citations to date
0
Altmetric
Research Article

An improved algorithm for dynamic nearest-neighbour models

ORCID Icon

Figures & data

Figure 1. Different networks, the nodes N of which are the stops of the national railway operator SJ in Sweden. (a) Network representation of the original network, (b) the Mocnik model for the nodes N and ρ=2, and (c) a Gilbert model (Gilbert Citation1959) for the nodes N and probability 103. The parameters are chosen such that similarities and dissimilarities visually stand out.

Figure 1. Different networks, the nodes N of which are the stops of the national railway operator SJ in Sweden. (a) Network representation of the original network, (b) the Mocnik model for the nodes N and ρ=2, and (c) a Gilbert model (Gilbert Citation1959) for the nodes N and probability 10−3. The parameters are chosen such that similarities and dissimilarities visually stand out.

Table 1. Average-case time complexity of the algorithms discussed in this article. Algorithm 1 is the naïve and Algorithm 2 the improved algorithm for generating a Mocnik model. As Algorithms A1–C2 are of supplementary nature (they are used by Algorithms 1 and 2) they are discussed in the appendix. The complexity refers to the dimension d, the number of nodes n, the parameter ρ of the Mocnik model, and, in case of Algorithms C1 and C2, to the radius r used in the algorithm. In Algorithm 2, the typical radius r˜ is a constant.

Table 2. Algorithms related to the index and the spatial grid. The algorithms refer to the dimension d of the space as well as to the number of grid cells per dimension μ.

Figure 2. Spatial grid for indexing nodes. The grid consists of μd cells, where d is the dimension and μ an integer. Each cell is of edge length 2/μ.

Figure 2. Spatial grid for indexing nodes. The grid consists of μd cells, where d is the dimension and μ an integer. Each cell is of edge length 2/μ.

Figure 3. Identifiers (IDs) for the spatial grid. The function toID translates from integer coordinates to IDs, while the function fromID translates into the opposite direction.

Figure 4. Volumes and surfaces in the spatial grid. (a) Volumes in the spatial grid, marked in blue, form hypercubes of adjacent cells. They are determined by their centre cell, here marked by a cross, and their radius. The volume at radius r is contained in the volume of radius r+1. (b) The surface at radius r is the volume at radius r with the volume at radius r1 removed.

Figure 4. Volumes and surfaces in the spatial grid. (a) Volumes in the spatial grid, marked in blue, form hypercubes of adjacent cells. They are determined by their centre cell, here marked by a cross, and their radius. The volume at radius r is contained in the volume of radius r+1. (b) The surface at radius r is the volume at radius r with the volume at radius r−1 removed.

Table 3. Running times of the naïve and the improved algorithm. The running times refer to the generation of a Mocnik model with parameter ρ=1.6. All times are given in seconds.

Figure 5. Running times of the naïve and the improved algorithm for generating a Mocnik model (ρ=1.6). (compare )

Figure 5. Running times of the naïve and the improved algorithm for generating a Mocnik model (ρ=1.6). (compare Table 3)

Figure 6. Running times of the improved algorithm for generating a Mocnik model (ρ=1.6), both with and without parallel execution. (compare )

Figure 6. Running times of the improved algorithm for generating a Mocnik model (ρ=1.6), both with and without parallel execution. (compare Table 3)

Table D1. Running times of the naïve and the improved algorithm, depending on the dimension of the embedding space. The running times refer the generation of a Mocnik model with 10,000 nodes and parameter ρ=1.6. All times are given in seconds.

Table D2. Running times of the naïve and the improved algorithm, depending on the parameter ρ. The running times refer the generation of a Mocnik model with 10,000 nodes. All times are given in seconds.

Figure D1. Running times of the naïve and the improved algorithm, depending on the dimension of the embedding space. The running times refer the generation of a Mocnik model with 10,000 nodes and parameter ρ = 1.6. (compare )

Figure D1. Running times of the naïve and the improved algorithm, depending on the dimension of the embedding space. The running times refer the generation of a Mocnik model with 10,000 nodes and parameter ρ = 1.6. (compare Table D1)

Figure D2. Running times of the naïve and the improved algorithm, depending on the parameter ρ. The running times refer the generation of a Mocnik model with 10,000 nodes. (compare )

Figure D2. Running times of the naïve and the improved algorithm, depending on the parameter ρ. The running times refer the generation of a Mocnik model with 10,000 nodes. (compare Table D2)

Data availability statement

The algorithm has been implemented as part of NetworKit (Staudt et al. Citation2016), an open-source toolkit for large-scale network analysis. It is available on https://networkit.github.io.