SlowGuess/NeurIPS_2023_OCR huggingface dataset:
[1] MohammadHossein Bateni, Hossein Esfandiari, Hendrik Fichtenberger, Monika Henzinger, Rajesh Jayaram, Vahab Mirrokni, and Andreas Wiese. Optimal fully dynamic  $k$ -center clustering for adaptive and oblivious adversaries. In Proceedings of the 2023 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 2677-2727. Society for Industrial and Applied Mathematics, 2023.
[2] Deeparnab Chakrabarty, Prachi Goyal, and Ravishankar Krishnaswamy. The non-uniform  $k$ -center problem. In Proceedings of the 43rd International Colloquium on Automata, Languages, and Programming (ICALP), volume 55 of LIPics. Leibniz Int. Proc. Inform., pages Art. No. 67, 15. Schloss Dagstuhl. Leibniz-Zent. Inform., Wadern, 2016.
[3] T-H. Hubert Chan, Arnaud Guerqin, and Mauro Sozio. Fully dynamic  $k$ -center clustering. In Proceedings of the 2018 World Wide Web Conference, pages 579-587, 2018.
[4] T-H. Hubert Chan, Silvio Lattanzi, Mauro Sozio, and Bo Wang. Fully dynamic  $k$ -center clustering with outliers. In Computing and Combinatorics: 28th International Conference, COCOON 2022, Shenzhen, China, October 22-24, 2022, Proceedings, pages 150-161. Springer, 2023.
[5] Moses Charikar, Chandra Chekuri, Tomás Feder, and Rajeev Motwani. Incremental clustering and dynamic information retrieval. In Proceedings of the twenty-ninth annual ACM symposium on Theory of computing, pages 626-635, 1997.
[6] Moses Charikar, Samir Khuller, David M. Mount, and Giri Narasimhan. Algorithms for facility location problems with outliers. In S. Rao Kosaraju, editor, Proceedings of the Twelfth Annual Symposium on Discrete Algorithms, January 7-9, 2001, Washington, DC, USA, pages 642-651. ACM/SIAM, 2001.
[7] Mark de Berg, Leyla Biabani, and Morteza Monemizadeh.  $k$ -center clustering with outliers in the MPC and streaming model. CoRR, abs/2302.12811, 2023.
[8] Hendrik Fichtenberger, Monika Henzinger, and Andreas Wiese. On fully dynamic constant-factor approximation algorithms for clustering problems. CoRR, abs/2112.07217, 2021.
[9] Teofilo F Gonzalez. Clustering to minimize the maximum intercluster distance. Theoretical computer science, 38:293-306, 1985.
[10] Gramoz Goranci, Monika Henzinger, Dariusz Leniowski, Christian Schulz, and Alexander Svozil. Fully dynamic  $k$ -center clustering in low dimensional metrics. In 2021 Proceedings of the Workshop on Algorithm Engineering and Experiments (ALENEX), pages 143-153. SIAM, 2021.
[11] Anupam Gupta, Robert Krauthgamer, and James R Lee. Bounded geometries, fractals, and low-distortion embeddings. In Proceedings of the 44th Annual IEEE Symposium on Foundations of Computer Science, 2003, pages 534-543. IEEE, 2003.
[12] Juha Heinonen. Lectures on analysis on metric spaces. Springer Science & Business Media, 2001.
[13] Dorit S Hochbaum and David B Shmoys. A unified approach to approximation algorithms for bottleneck problems. Journal of the ACM (JACM), 33(3):533-550, 1986.
[14] Wen-Lian Hsu and George L. Nemhauser. Easy and hard bottleneck location problems. Discrete Applied Mathematics, 1(3):209-215, 1979.
[15] Robert Krauthgamer and James R Lee. Navigating nets: Simple algorithms for proximity search. In Proceedings of the fifteenth annual ACM-SIAM symposium on Discrete algorithms, pages 798-807. Citeseer, 2004.
[16] Stuart P. Lloyd. Least squares quantization in PCM. IEEE Transactions on Information Theory, 28(2):129-137, 1982. Originally published in 1957 as Bell Laboratories Technical Memorandum.
[17] Richard Matthew McCutchen and Samir Khuller. Streaming algorithms for  $k$ -center clustering with outliers and with anonymity. In Approximation, Randomization and Combinatorial Optimization. Algorithms and Techniques, pages 165-178. Springer, 2008.
[18] Paolo Pellizzoni, Andrea Pietracaprina, and Geppino Pucci. Fully dynamic clustering and diversity maximization in doubling metrics. CoRR, abs/2302.07771, 2023.
[19] Melanie Schmidt and Christian Sohler. Fully dynamic hierarchical diameter  $k$ -clustering and  $k$ -center. arXiv preprint arXiv:1908.02645, 2019.
A Maintaining the data structure
As we explained in Section 2, our data structure consists of  $O(\log \Delta)$  levels  $R \coloneqq \{0\} \cup \{\beta \cdot 2^{\ell} \mid \ell \in \mathbb{Z}, 0 \leq \ell \leq \lceil \log_2 \Delta \rceil + 1\}$ , where  $\frac{1}{2} < \beta \leq 1$  is a given parameter. Similar to Krauthgamer and Lee [15], on each level  $r$ , we maintain net  $N_{r}$ , which is an  $r$ -net of  $N_{r/2}$ . In this section, we explain how to maintain our data structure after each insert/delete update, and analyze the update time.
For every point  $p \in N_r$ , we maintain the sets of all its parents and all its children. We start by bounding the number of children and parents of each point. Recall that  $p \in N_r$  is called a parent of  $q \in N_{r/2}$  if  $d(p, q) \leq r$ . We first show that the number of children for each point is of size  $2^{O(\dim)}$ .
Lemma A.1 (Number of children). Let  $p \in N_r$ . The number of children of  $p$  is at most  $2^{2^{\dim}}$ .
Proof. For every child  $q \in N_{r/2}$  of  $p$  it is  $d(p, q) \leq r$ . Therefore, the set of children is covered by  $\operatorname{Ball}(p, r)$ . Using the definition of doubling dimension twice, it follows that the set of children can be covered by  $2^{2^{\dim}}$  balls of radius  $r/4$ . As any two points in  $N_{r/2}$  have distance at least  $r/2$ , the claim follows.
Then, in a similar fashion, we can deduce the number of parents.
Lemma A.2 (Number of parents). Let  $p \in N_r$ . The number of parents of  $p$  is bounded by  $2^{O(\dim)}$ .
A.1 Finding the neighbours
In this section, we explain FindNeighbours, which takes as input a value  $\gamma \geq 2$  and a point  $p \in P_t$  and returns for every  $r \in R \setminus \{0\}$  the set of neighbors of  $p$  within distance  $\gamma r$ . Later, we use this procedure to maintain our data structure after insertions and deletions.
Procedure FINDNEIGHBOURS(p,  $\gamma$  )   
1  $r_{\mathrm{max}}\coloneqq \beta \cdot 2^{[\log_2\Delta ]}$    
2  $r\gets r_{\mathrm{max}}$    
3  $S_{r}\leftarrow N_{r}$    
4 while  $r > \beta$  do   
5  $r\gets r / 2$    
6  $S_{r}\gets \emptyset$    
7 for all  $s\in S_{2r}$  do   
8 for all children  $q\in N_r$  of s do   
9 if  $d(p,q)\leq \gamma \cdot r$  then   
10  $\begin{array}{rl} & {\underset {S_r}{\mathsf{if}}d(p,q)\leq \gamma \cdot r\text{then}}\\ & {\underset {S_r}{\mathsf{if}}d(p,q)\leq \gamma \cdot r\text{then}}\\ & {\underset {S_r}{\mathsf{if}}d(p,q)\leq \gamma \cdot r\text{then}}\\ & {\underset {S_r}{\mathsf{if}}d(p,q)\leq \gamma \cdot r\text{then}}\\ & {\underset {S_{r}}{\mathsf{if}}d(p,q)\leq \gamma \cdot r\text{then}}\\ & {\underset {S_{r}}{\mathsf{if}}d(p,q)\leq \gamma \cdot r\text{then}}\\ & {\underset {S_{r}}{\mathsf{if}}d(p,q)\leq \gamma \cdot r\text{then}}\\ & {\underset {S_{r}}{\mathsf{for}}d(p,q)\leq \gamma \cdot r\text{then}}\\ & {\underset {S_{r}}{\mathsf{for}}d(p,q)\leq \gamma \cdot r\text{then}}\\ & {\underset {S_{r}}{\mathsf{for}}d(p,q)\leq \gamma \cdot r\text{then}}\\ & {\underset {S_{r}}{\mathsf{for}}d(p, q)\leq \gamma \cdot r\text{then}}\\ & {\underset {S_{r}}{\mathsf{for}}d(p, q)\leq \gamma \cdot r\text{then}}\\ & {\underset {S_{r}}{\mathsf{for}}d(p, q)\leq \gamma \cdot r\text{then}}\\ & {\underset {S_{r}}{\mathsf{for}}d(p, q) = 0.} \end{array}$    
9   
10   
11 return  $S_{\beta},S_{2\beta},S_{4\beta},S_{8\beta},\ldots ,S_{r_{max}}$
Lemma A.3. Let  $p \in P$ , and  $\gamma \geq 2$ . Then, for all  $r \in R \setminus \{0\}$ , set  $S_r$  that we compute in FindNeighbours( $p, \gamma$ ) consists of all elements in  $N_r$  within distance  $\gamma \cdot r$  of  $p$ .
Proof. We show the statement via induction on  $r$ . For  $r = r_{\max} = \beta \cdot 2^{\lceil \log \Delta \rceil}$ , line 3 implies  $S_r = N_r$  and therefore the statement is trivially fulfilled. Now assume the statement holds for  $2r$ , where  $r < r_{\max}$ . Consider  $x \in N_r$  such that  $d(p, x) \leq \gamma r$ . Then,  $d(p, \mathrm{rep}_{2r}(x)) \leq d(p, x) + d(x, \mathrm{rep}_{2r}(x)) \leq \gamma r + 2r \leq 2\gamma r$ , hence, by induction hypothesis,  $\mathrm{rep}_{2r}(x) \in S_{2r}$ . This means,  $x$  is a child of an element in  $S_{2r}$ , and the condition of the for loop in line 8 holds. As further  $d(p, x) \leq \gamma r$  by assumption,  $x$  is added to  $S_r$  in line 10.
Next, we bound the size of set  $S_r$  in Lemma A.4.
Lemma A.4. Let  $r \in R$ . Then, set  $S_r$  computed in FindNeighbours( $p, \gamma$ ) is of size  $\gamma^{\dim 2^{O(\dim)}}$ .
Proof. The condition in Line 9 of FindNeighbours implies that any point  $x \in S_r$  is within distance  $\gamma \cdot r$  of  $p$ . Hence,  $S_r$  is covered by  $\operatorname{Ball}(p, \gamma \cdot r)$ . Besides,  $S_r \subseteq N_r$ , which means that the distance between any two points in  $S_r$  is more than  $r$ . By applying the definition of doubling dimension, it
follows that  $\mathrm{Ball}(p,\gamma \cdot r)$  can be covered by  $\gamma^{\mathrm{dim}}\cdot 2^{O(\mathrm{dim})}$  balls of radius  $r / 2$  . Adding it to  $S_{r}\subseteq N_{r}$  implies that each of these balls of radius  $r / 2$  contains at most one point from  $S_{r}$  . Therefore,  $S_{r}$  is of size  $\gamma^{\mathrm{dim}}\cdot 2^{O(\mathrm{dim})}$
Lemma A.5. Let  $p \in P$  and  $\gamma \geq 2$  be given. Then, the procedure FindNeighbours $(p, \gamma)$  runs in time  $2^{O(\dim)} \gamma^{\dim} \log \Delta$ .
Proof. The while loop in Line 4 iterates backward through all the  $O(\log \Delta)$  levels. On every level, all children of all  $s \in S_{2r}$  are examined. By Lemma A.4,  $|S_{2r}| \in \gamma^{\dim} 2^{O(\dim)}$  and by Lemma A.1, every  $s \in |S_{2r}|$  has  $2^{2^{\dim}}$  children. Multiplying these terms yields the claim.
A.2 Insertion
In this section, we show how to maintain our data structure after the insertion of point  $p$ . As described in Algorithm 2, we start by calling FindNeighbours, which goes through the levels from top to bottom (high to low) and recursively computes set  $S_r$  for each level  $r$ . Lemma A.3 implies that for any point  $q \in N_r$ , if  $d(p, q) \leq r$ , then  $S_r$  contains  $q$ . This guarantees that later we can find all parents and children of  $p$  using these  $S_r$  sets. Next, we go through the levels from bottom to top to find the lowest level  $\hat{r}$ , in which we can find a representative for  $p$ , or in other words, there is a  $q \in N_{\hat{r}}$  within distance  $\hat{r}$  of  $p$ . Then, we add  $p$  to all levels lower than  $\hat{r}$ . For levels  $r > \hat{r}$ , we do not need to add  $p$  to  $N_r$  because there is already a point in level  $r$  that can represent  $p$  by the definition of  $\hat{r}$ . We determine this representative recursively according to  $\mathrm{rep}_{\hat{r}}(p)$ . Finally, we increase the weight for the respective representative of  $p$  in each level by one.
Algorithm 2: INSERT  $(p)$
1  $r_{\mathrm{max}}\coloneqq \beta \cdot 2^{\lceil \log_2\Delta \rceil}$    
2  $S_{\beta},S_{2\beta},S_{4\beta},S_{8\beta},\ldots ,S_{r_{\mathrm{max}}} \leftarrow$  FindNeighbours(p,2)   
3 // finding the lowest level  $\hat{r}$  that can have a representative for  $p$    
4  $r\gets \beta ,\hat{r}\gets 2r_{\mathrm{max}}$    
5 while  $r\leq r_{\mathrm{max}}$  do   
6 if there is a point  $s\in S_r$  such that  $d(p,s)\leq r$  then   
7  $\begin{array}{rl} & {\hat{r}\gets r}\\ & {\mathrm{rep}_{\hat{r}}(p)\gets s}\\ & {\mathrm{for~all~}s\in S_r~\mathrm{such~that~}d(p,s)\leq r~\mathrm{do}}\\ & {\mathrm{Save~}s~\mathrm{as~a~parent~of~}p~\mathrm{and~save~}p~\mathrm{as~a~child~of~}s}\\ & {\mathrm{break}}\\ & {r\gets 2r} \end{array}$    
9   
10   
11   
12   
13 // adding  $p$  to all levels lower than  $\hat{r}$    
14 for all  $r\in R$  such that  $r <   \hat{r}$  do   
15  $\begin{array}{rl} & N_r\gets N_r\cup \{p\} \\ & \mathrm{Save~}p\in N_r~\mathrm{as~a~parent~of~}p\in N_{r / 2}\mathrm{~and~save~}p\in N_{r / 2}\mathrm{~as~a~child~of~}p\in N_r\\ & \mathrm{rep}_r(p)\gets p \end{array}$    
17   
18 UPDATENEIGHBOURHOODADD  $(p,\hat{r})$    
19 // finding the representative of  $p$  in all levels upper than  $\hat{r}$    
20  $r\gets 2\hat{r}$    
21 while  $r\leq r_{\mathrm{max}}$  do   
22  $\begin{array}{rl} & {\mathrm{rep}_r(p)\gets \mathrm{rep}_r(\mathrm{rep}_{r / 2}(p))}\\ & {r\gets 2r} \end{array}$    
23
After inserting the point  $p$  to  $N_{\varepsilon r}$ , we need to compute  $B_{p,r}^{1}$  and  $B_{p,r}^{3}$ . Besides, for any point  $q \in B_{p,r}^{1}$  ( $q \in B_{p,r}^{3}$  similarly), we need to add  $p$  to  $B_{q,r}^{1}$  ( $B_{q,r}^{3}$  similarly). We perform this operation
Procedure UPDATENEIGHBOURHOODADD  $(p,\hat{r})$  : a procedure to update neighbourhoods after adding  $p$  to all levels below  $N_{\hat{r}}$
1  $r_{\mathrm{max}}\coloneqq \beta \cdot 2^{\lceil \log_2\Delta \rceil}$    
2  $T_{\beta},T_{2\beta},T_{4\beta},T_{8\beta},\ldots ,T_{r_{\mathrm{max}}} \leftarrow$  FindNeighbours  $(p,(3 + 8\varepsilon) / \varepsilon)$    
3 // updating neighborhoods  $B^{1}$  and  $B^{3}$    
4 for all  $r^\prime \in R$  such that  $r^\prime < \hat{r}$  and  $r^\prime /\varepsilon \leq r_{\mathrm{max}}$  do  
5  $r\coloneqq r^{\prime} / \varepsilon$ $\triangleright r^{\prime} = \varepsilon r$    
6  $B_{p,r}^{3}\gets \emptyset ,B_{p,r}^{1}\gets \emptyset$    
7 for all  $q\in T_{r'}$  do  
8  $\begin{array}{rlr}{B_{p,r}^{3}\gets B_{p,r}^{3}\cup \{q\} ,B_{q,r}^{3}\gets B_{q,r}^{3}\cup \{p\}} & {} & {\triangleright d(p,q)\leq (3 + 8\varepsilon)r}\\ {\mathbf{if}d(p,q)\leq (1 + 4\varepsilon)r\mathbf{then}}\\ {B_{p,r}^{1}\gets B_{p,r}^{1}\cup \{q\} ,B_{q,r}^{1}\gets B_{q,r}^{1}\cup \{p\}} & {} & {} \end{array}$
in Procedure UpdateNeighbourhoodAdd. In Lemma A.6, we analyze the correctness and update time of this procedure.
Lemma A.6. Let  $p$  be a point to be inserted and  $\hat{r}$  as in the algorithm after execution of the while loop in Line 5. Then, UPDATENEIGHBOURHOODADD(p,  $\hat{r}$ ) that we invoke in Line 18 of Algorithm 2, finds  $B_{p,r}^{1}$  and  $B_{p,r}^{3}$  for any  $r \in R$  such that  $\varepsilon r < \hat{r}$ . Besides, the total update time of this procedure is  $2^{O(\dim)}\varepsilon^{-\dim}\log \Delta$ .
Proof. By Lemma A.3,  $T_{r'}$  contains all points of  $N_{r'}$  within distance  $(3 + 8\varepsilon)r'/\varepsilon$  of  $p$ . Then if we define  $r := r'/\varepsilon$ , it holds that  $T_{r'}$  contains all points of  $N_{\varepsilon r}$  within distance  $(3 + 8\varepsilon)r'/\varepsilon = (3 + 8\varepsilon)r$  of  $p$ . This means that we can find  $B_{p,r}^3$  by exploring  $T_{r'}$ , which we do in Line 8 of the procedure. By restricting to points  $q$  in  $T_{r'}$  such that  $d(p,q) \leq (1 + 4\varepsilon)r$ , we find all the points that belong to  $B_{p,r}^1$ .
We next discuss the running time. Lemma A.5 states that the running time of FindNeighbours  $(p,(3 + 8\varepsilon) / \varepsilon)$  is  $2^{O(\dim)}\varepsilon^{-\dim}\log \Delta$ . Then, we iterate over  $T_{r'}$  for at most  $O(\log \Delta)$  values of  $r'$ , which takes  $O(|T_{r'}|)$  for each iteration. Lemma A.4 shows that  $T_{r'}$  is of size  $((3 + 8\varepsilon) / \varepsilon)^{\dim}2^{O(\dim)} = 2^{O(\dim)}\varepsilon^{-\dim}$ . Therefore, the total running time of these  $O(\log \Delta)$  iterations is also  $2^{O(\dim)}\varepsilon^{-\dim}\log \Delta$ , which finishes the proof.
Updating the heaps. To avoid redundancy, we do not include updating Heaps  $H_{r}$  in the pseudocodes. However, it can be easily handled. Note that neighborhoods  $B_{x,r}^{1}$  and  $B_{y,r}^{1}$  are balls of the same size. Therefore,  $y \in B_{x,r}^{1}$  is equivalent to  $x \in B_{y,r}^{1}$ . Hence, whenever the weight of a point  $x$  in  $N_{r}$  is changed, it is enough to update the weight of all points in  $B_{x,r}^{1}$  and their corresponding element in heap  $H_{r}$ . The size of  $B_{x,r}^{1}$  is  $2^{O(\dim)}\varepsilon^{-\dim}$  by Lemma 2.2, and we can do each heap update in  $O(\log n)$  time. Therefore, an extra  $2^{O(\dim)}\varepsilon^{-\dim}\log n$  factor will be multiplied by the running time of Algorithm 2 due to maintaining the heaps.
Lemma A.7. Let  $n$  be the size of point set  $P_{t}$ . Then after insertion of any point to  $P_{t}$ , we can update our data structure in time  $2^{O(\dim)}\varepsilon^{-2\dim}\log \Delta \log n$ .
Proof. As we discussed above, a  $2^{O(\dim)}\varepsilon^{-\dim}\log n$  factor will be multiplied by the running time of Algorithm 2 due to maintaining the heaps. Therefore, it is enough to show that the running time of Algorithm 2 is  $2^{O(\dim)}\varepsilon^{-\dim}\log \Delta$ .
In Algorithm 2, we first call FindNeighbours  $(p,2)$ , which takes  $2^{O(\dim)}\log \Delta$  according to Lemma A.5. To find  $\hat{r}$ , we next iterate over  $S_{r}$  for at most  $O(\log \Delta)$  values of  $r$ . Then, we add  $p$  to all levels lower than  $\hat{r}$ , which takes time  $\log \Delta$ . We next invoke UpdateNeighbourhoodAdd  $(p,\hat{r})$ , which is done in time  $2^{O(\dim)}\varepsilon^{-\dim}\log \Delta$  according to Lemma A.6. This takes  $2^{O(\dim)}\log \Delta$ , since  $S_{r}$  is of size  $2^{O}(\dim)$  by Lemma A.4. Finally, we update the representatives of  $p$  and their weights, which is done in time  $O(\log \Delta)$ . Putting everything together proves that the running time of Algorithm 2 is  $2^{O(\dim)}\varepsilon^{-\dim}\log \Delta$ , which finishes the proof.
A.3 Deletion
In this section, we explain how to maintain our data structure after the deletion of point  $p$ . As described in Algorithm 3, we first produce sets  $S_{r}$  and  $T_{r}$  for all  $r \in R$  that are used for updating parents and children as well as neighborhoods. We then iterate over the levels  $r \in R$  from bottom to top. During the algorithm, we may elevate some points from  $N_{r/2} \setminus N_{r}$  to  $N_{r}$  to maintain our data structure. We refer to the set of these points that are elevated to  $N_{r}$  as  $E_{r}$ . After changing the representative of a point, we need to change the weights of its previous representative in the next level as well as the indirect previous representatives in the upper levels. To make this process of updating weights efficient, we define the set  $D_{r}$  and a function  $\delta_{r} \colon D_{r} \to \mathbb{Z}$  for each  $r \in R$ . The set  $D_{r}$  refers to the set of points  $q \in N_{r}$  whose weight should be updated by the value  $\delta_{r}[q]$ .
After deleting  $p$ , we need to find a new representative for any point  $q \in N_{r/2}$  and also reduce  $w_{r/2}(q)$  from its previous indirect representatives in the upper levels. To do this, we decrease  $\delta_{2r}[\mathrm{rep}_{2r}(p)]$  by  $w_{r/2}(q)$ . After deleting  $p$  from  $N_r$ , any point  $q \in N_{r/2}$  that was represented by  $p$  in  $N_r$  would not have any representative. Besides, we need to find a representative in  $N_r$  for the points in  $E_{r/2}$ . Let  $q \in N_{r/2}$  be a point such that  $\mathrm{rep}_r(q) = p$  or  $q \in E_{r/2}$ . To find a new representative for  $q$  in  $N_r$ , we consider two cases: either  $q$  has a parent in  $N_r \setminus \{p\}$  or  $p$  is the only parent of  $q$  in  $N_r$ .
For the first case, we choose a parent  $x \in N_r \setminus \{p\}$  of  $q$  as its representative in  $N_r$ . Then, we increase  $w_{r}(x)$  and  $\delta_{2r}[\mathrm{rep}_{2r}(x)]$  by  $w_{r/2}(q)$  to update the weight of all points that represent  $q$  in higher levels directly or indirectly. For the second case, we have to elevate  $q$  to  $N_r$ . After elevating  $q$  to  $N_r$ , we need to find its parents and children. To find the children, it is enough to explore  $S_{r/2}$ . It is because if  $s \in N_{r/2}$  is a child of  $q \in N_r$ , then  $d(q, s) \leq r$ . Adding it to  $d(p, q) \leq r$ , we have  $d(p, s) \leq 2r = 4(r/2)$  by triangle inequality. Therefore,  $s \in S_{r/2}$  and it is enough to explore  $S_{r/2}$ . With a similar argument, it is enough to explore  $S_{2r}$  to find the parents of  $q$  in  $N_{2r}$ .
We next call UpdateNeighbourhoodElevate  $(q,r,T_r)$ . In Lemma A.9, we show that this procedure can compute  $B_{q,r/\varepsilon}^{1}$  and  $B_{q,r/\varepsilon}^{3}$  by exploring  $T_r$ .
At the end of each iteration, we call UPDATENEIGHBOURHOODREMOVE  $(p,r)$ . This procedure deletes  $p$  from all the neighborhoods of level  $r$  that contain  $p$ . Note that for  $i \in \{1,3\}$ ,  $p \in B_{x,r}^i$  and  $x \in B_{p,r}^i$  are equivalent. Hence, it is enough to iterate over all  $x \in B_{p,r}^i$  and delete  $p$  from  $B_{x,r}^i$  for  $i = \{1,3\}$ .
To show that UpdateNeighbourhoodElevate computes the neighborhoods in Lemma A.9, we first prove Lemma A.8, which is about the distance of the points in  $E_r$  to  $p$ .
Lemma A.8. Let  $r \in R$ , and let  $E_r$  be the set of elevated points in Algorithm 3. Then, for any point  $q \in E_r$  we have  $d(p,q) \leq r$ .
Proof. Let  $\hat{r}$  be the smallest level in  $R$  such that  $q$  is elevated to it. It means that  $q$  is a child of  $p \in N_{\hat{r}}$ , and therefore,  $d(p,q) \leq \hat{r}$ . Besides, we have  $\hat{r} \leq r$ , which implies  $d(p,q) \leq r$ .
We next call UPDATENEIGHBOURHOODELEVATE to create  $B_{q,r}^{1}$  and  $B_{q,r}^{3}$ , as well as to add  $q$  to the neighborhoods in level  $r$  that must contain  $q$ .
Lemma A.9. Let  $r' \in R$ ,  $q \in E_{r'}$  and  $T_{r'}$  as constructed in Line 3 of Algorithm 3. We define  $r := r'/\varepsilon$ . The procedure UpdateNeighbourhoodElevate( $q, r', T_{r'}$ ) computes  $B_{q,r}^{1}$  and  $B_{q,r}^{3}$  and updates the neighborhoods  $B_{q',r}^{1}$  (and  $B_{q',r}^{3}$ ) for all  $q' \in B_{q,r}^{1}$  ( $q' \in B_{q,r}^{3}$ ) by adding  $q$  to them. Besides, this procedure runs in time  $O(\varepsilon^{-\dim}2^{O(\dim)})$ .
Proof. Let  $p$  be the point to be deleted when calling Algorithm 3.  $q \in E_{r'}$  implies that either  $p$  was the representative of  $q$  in  $N_{r'}$ , or  $q \in E_{r'/2}$ . If  $p$  was the representative of  $q$  in  $N_{r'}$ , we have  $d(p, q) \leq r'$ . Otherwise, if  $q \in E_{r'/2}$ , Lemma A.8 states that  $d(p, q) \leq r'/2 \leq r'$ . Therefore,  $d(p, q) \leq r'$  always holds. By Lemma A.3,  $T_{r'}$  contains all points  $x \in N_{r'}$  such that  $d(p, x) \leq (1 + (3 + 8\varepsilon)/\varepsilon)r' = r' + (3 + 8\varepsilon)r$ , for  $r = r'/\varepsilon$ . Let  $q' \in N_{r'}$  be a point such that  $d(q, q') \leq (3 + 8\varepsilon)r$ . We claim that we add  $q'$  to  $B_{q,r}^3$ . To do this, it is enough to show that  $q' \in T_{r'}$ . As we mentioned,  $d(p, q) \leq r'$  and  $d(q, q') \leq (3 + 8\varepsilon)r$ . Then by the triangle inequality we have  $d(p, q') \leq d(p, q) + d(q, q') \leq r' + (3 + 8\varepsilon)r$ , which means that  $q' \in T_{r'}$  and it is enough to explore  $T_{r'}$  for computing  $B_{q,r}^3$ . Note that the same argument also works for  $B_{q,r}^1$ .