SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Algorithm 1: CONSTRUCTORACLE  $(G,k,\varphi ,\varepsilon ,\gamma)$
1 Let  $\xi = \frac{\sqrt{\gamma}}{1000}$  and let  $s = \frac{10\cdot k\log k}{\gamma}$    
2 Let  $\theta = 0.96(1 - \frac{4\sqrt{\varepsilon}}{\varphi})\frac{\gamma k}{n} -\frac{\sqrt{k}}{n} (\frac{\varepsilon}{\varphi^2})^{1 / 6} - \frac{\xi}{n}$    
3 Sample a set S of s vertices independently and uniformly at random from V   
4 Generate a similarity graph  $H = (S,\emptyset)$    
5 Let  $\mathcal{D} =$  INITIALIZEORACLE  $(G,1 / 2,\xi)$    
6 for any u,v E S do   
7 Let  $\langle f_u,f_v\rangle_{\mathrm{apx}} =$  SPECTRALDOTPRODUCTORACLE(G,u,v,1/2,  $\xi ,\mathcal{D})$    
8 if  $\langle f_u,f_v\rangle_{\mathrm{apx}}\geq \theta$  then   
9 Add an edge  $(u,v)$  to the similarity graph  $H$    
10 if H has exactly k connected components then   
11 Label the connected components with 1,2,...,k (we write them as  $S_{1},\ldots ,S_{k})$    
12 Label  $x\in S$  with i if  $x\in S_{i}$    
13 Return H and the vertex labeling  $\ell$    
14 else   
15 return fail
to check whether the queried vertex  $x$  belongs to a unique connected component in  $H$ . If it does, SEARCHINDEX( $H, \ell, x$ ) will return the index of the unique connected component in  $H$ .
The algorithm in preprocessing phase is given in Algorithm 1 CONSTRUCTORACLE  $(G,k,\varphi ,\varepsilon ,\gamma)$
See Appendix C for algorithm INITIALIZEORACLE and SPECTRALDOTPRODUCTORACLE invoked by CONSTRUCTORACLE  $(G,k,\varphi ,\varepsilon ,\gamma)$
Our algorithms used in the query phase are described in Algorithm 2 SEARCHINDEX  $(H,\ell ,x)$  and Algorithm 3 WHICHCLUSTER  $(G,x)$ .
Algorithm 2: SEARCHINDEX  $(H,\ell ,x)$
1 for any vertex  $u\in S$  do   
2 Let  $\langle f_u,f_x\rangle_{\mathrm{apx}} = \mathrm{SPECTRALDOTPRODUCTORACLE}(G,u,x,1 / 2,\xi ,\mathcal{D})$    
3 if there exists a unique index  $1\leq i\leq k$  such that  $\langle f_u,f_x\rangle_{\mathrm{apx}}\geq \theta$  for all  $u\in S_i$  then   
4 return index  $i$    
5 else   
6 return outlier
Algorithm 3: WHICHCLUSTER  $(G,x)$
1 if preprocessing phase fails then  
2 return fail  
3 if SEARCHINDEX  $(H,\ell ,x)$  return outlier then  
4 return a random index  $\in [k]$   
5 else  
6 return SEARCHINDEX  $(H,\ell ,x)$
3.3 Analysis of the oracle
We now prove the following property: for most vertex pairs  $x, y$ , if  $x, y$  are in the same cluster, then  $\langle f_x, f_y \rangle$  is rough  $O\left(\frac{k}{n}\right)$  (Lemma 3.4); and if  $x, y$  are in the different clusters, then  $\langle f_x, f_y \rangle$  is close to 0 (Lemma 3.5). We make use of the following three lemmas. Due to the limited space, all the missing proofs will be given in Appendix D.
The following lemma shows that for most vertices  $x$ , the norm  $\| f_x\| _2$  is small.
Lemma 3.1. Let  $\alpha \in (0,1)$ . Let  $k \geq 2$  be an integer,  $\varphi \in (0,1)$ , and  $\varepsilon \in (0,1)$ . Let  $G = (V,E)$  be a  $d$ -regular  $(k,\varphi,\varepsilon)$ -clusterable graph with  $|V| = n$ . There exists a subset  $\widehat{V} \subseteq V$  with  $|\widehat{V}| \geq (1 - \alpha)|V|$  such that for all  $x \in \widehat{V}$ , it holds that  $\|f_x\|_2 \leq \sqrt{\frac{1}{\alpha} \cdot \frac{k}{n}}$ .
We then show that for most vertices  $x$ ,  $f_{x}$  is close to its center  $\mu_{x}$  of the cluster containing  $x$ .
Lemma 3.2. Let  $\beta \in (0,1)$ . Let  $k \geq 2$  be an integer,  $\varphi \in (0,1)$ , and  $\varepsilon \in (0,1)$ . Let  $G = (V,E)$  be a  $d$ -regular graph that admits a  $(k,\varphi,\varepsilon)$ -clustering  $C_1, \ldots, C_k$  with  $|V| = n$ . There exists a subset  $\widetilde{V} \subseteq V$  with  $|\widetilde{V}| \geq (1 - \beta)|V|$  such that for all  $x \in \widetilde{V}$ , it holds that  $\|f_x - \mu_x\|_2 \leq \sqrt{\frac{4k\varepsilon}{\beta\varphi^2} \cdot \frac{1}{n}}$ .
The next lemma shows that for most vertices  $x$  in a cluster  $C_i$ , the inner product  $\langle f_x, \mu_i \rangle$  is large.
Lemma 3.3. Let  $k \geq 2$  be an integer,  $\varphi \in (0,1)$ , and  $\frac{\varepsilon}{\varphi^2}$  be smaller than a sufficiently small constant. Let  $G = (V,E)$  be a d-regular graph that admits a  $(k,\varphi ,\varepsilon)$ -clustering  $C_1,\ldots ,C_k$ . Let  $C_i$  denote the cluster corresponding to the center  $\mu_{i}$ ,  $i \in [k]$ . Then for every  $C_i$ ,  $i \in [k]$ , there exists a subset  $\widetilde{C_i} \subseteq C_i$  with  $|\widetilde{C_i}| \geq (1 - \frac{10^4\varepsilon}{\varphi^2})|C_i|$  such that for all  $x \in \widetilde{C_i}$ , it holds that  $\langle f_x,\mu_i\rangle \geq 0.96\| \mu_i\| _2^2$ .
For the sake of description, we introduce the following definition.
Definition 3.1 (Good and bad vertices). Let  $k \geq 2$  be an integer,  $\varphi \in (0,1)$ , and  $\frac{\varepsilon}{\varphi^2}$  be smaller than a sufficiently small constant. Let  $G = (V,E)$  be a  $d$ -regular  $n$ -vertex graph that admits a  $(k,\varphi,\varepsilon)$ -clustering  $C_1, \ldots, C_k$ . We call a vertex  $x \in V$  a good vertex with respect to  $\alpha \in (0,1)$  and  $\beta \in (0,1)$  if  $x \in (\widehat{V} \cap \widetilde{V} \cap (\cup_{i=1}^{k} \widetilde{C}_i))$ , where  $\widehat{V}$  is the set as defined in Lemma 3.1,  $\widetilde{V}$  is the set as defined in Lemma 3.2 and  $\widetilde{C_i}$  ( $i \in [k]$ ) is the set as defined in Lemma 3.3. We call a vertex  $x \in V$  a bad vertex with respect to  $\alpha \in (0,1)$  and  $\beta \in (0,1)$  if it's not a good vertex with respect to  $\alpha$  and  $\beta$ .
Note that for a good vertex  $x$  with respect to  $\alpha \in (0,1)$  and  $\beta \in (0,1)$ , the following hold: (1)  $\| f_x\| _2\leq \sqrt{\frac{1}{\alpha}\cdot\frac{k}{n}}$ ; (2)  $\| f_{x} - \mu_{x}\|_{2}\leq \sqrt{\frac{4k\varepsilon}{\beta\varphi^{2}}\cdot\frac{1}{n}}$ ; (3)  $\langle f_x,\mu_x\rangle \geq 0.96\| \mu_x\| _2^2$ . For a bad vertex  $x$  with respect to  $\alpha \in (0,1)$  and  $\beta \in (0,1)$ , it does not satisfy at least one of the above three conditions.
The following lemma shows that if vertex  $x$  and vertex  $y$  are in the same cluster and both of them are good vertices with respect to  $\alpha$  and  $\beta$  ( $\alpha$  and  $\beta$  should be chosen appropriately), then the spectral dot product  $\langle f_x, f_y \rangle$  is roughly  $0.96 \cdot \frac{1}{|C_i|}$ .
Lemma 3.4. Let  $k \geq 2$ ,  $\varphi \in (0,1)$  and  $\frac{\varepsilon}{\varphi^2}$  be smaller than a sufficiently small constant. Let  $G = (V,E)$  be a d-regular  $n$ -vertex graph that admits a  $(k,\varphi,\varepsilon)$ -clustering  $C_1, \ldots, C_k$ . Suppose that  $x,y \in V$  are in the same cluster  $C_i$ ,  $i \in [k]$  and both of them are good vertices with respect to  $\alpha = 2\sqrt{k} \cdot (\frac{\varepsilon}{\varphi^2})^{1/3}$  and  $\beta = 2\sqrt{k} \cdot (\frac{\varepsilon}{\varphi^2})^{1/3}$ . Then  $\langle f_x, f_y \rangle \geq 0.96\left(1 - \frac{4\sqrt{\varepsilon}}{\varphi}\right)\frac{1}{|C_i|} - \frac{\sqrt{k}}{n} \cdot \left(\frac{\varepsilon}{\varphi^2}\right)^{1/6}$ .
The following lemma shows that if vertex  $x$  and vertex  $y$  are in different clusters and both of them are good vertices with respect to  $\alpha$  and  $\beta$  ( $\alpha$  and  $\beta$  should be chosen appropriately), then the spectral dot product  $\langle f_x, f_y \rangle$  is close to 0.
Lemma 3.5. Let  $k \geq 2$ ,  $\varphi \in (0,1)$  and  $\frac{\varepsilon}{\varphi^2}$  be smaller than a sufficiently small constant. Let  $G = (V,E)$  be a d-regular  $n$ -vertex graph that admits a  $(k,\varphi,\varepsilon)$ -clustering  $C_1, \ldots, C_k$ . Suppose that  $x \in C_i$ ,  $y \in C_j$ ,  $(i,j \in [k], i \neq j)$  and both of them are good vertices with respect to  $\alpha = 2\sqrt{k} \cdot (\frac{\varepsilon}{\varphi^2})^{1/3}$  and  $\beta = 2\sqrt{k} \cdot (\frac{\varepsilon}{\varphi^2})^{1/3}$ , the following holds:
$$
\langle f _ {x}, f _ {y} \rangle \leq \frac {\sqrt {k}}{n} \cdot \left(\frac {\varepsilon}{\varphi^ {2}}\right) ^ {1 / 6} + \frac {\sqrt {2} k ^ {1 / 4}}{\sqrt {n}} \cdot \left(\frac {\varepsilon}{\varphi^ {2}}\right) ^ {1 / 3} \cdot \sqrt {\left(1 + \frac {4 \sqrt {\varepsilon}}{\varphi}\right) \frac {1}{| C _ {j} |}} + \frac {8 \sqrt {\varepsilon}}{\varphi} \cdot \frac {1}{\sqrt {| C _ {i} |} \cdot | C _ {j} |}.
$$
Proof of Theorem 1. Now we prove our main result Theorem 1.
Proof. Let  $s = \frac{10k\log k}{\gamma}$  be the size of sampling set  $S$ , let  $\alpha = \beta = 2\sqrt{k}\cdot (\frac{\varepsilon}{\varphi^2})^{1 / 3}$ . Recall that we call a vertex  $x$  a bad vertex, if  $x\in (V\backslash \widehat{V})\cup (V\backslash \widetilde{V})\cup (V\backslash (\cup_{i = 1}^{k}\widetilde{C}_{i}))$ , where  $\widehat{V},\widetilde{V},\widetilde{C}_i,i\in [k]$  are defined in Lemma 3.1, 3.2, 3.3 respectively. We use  $B$  to denote the set of all bad vertices. Then we have  $|B|\leq (\alpha +\beta +\frac{10^4\varepsilon}{\varphi^2})\cdot n = (4\sqrt{k}\cdot (\frac{\varepsilon}{\varphi^2})^{1 / 3} + \frac{10^4\varepsilon}{\varphi^2})\cdot n$ . We let  $\kappa \leq 4\sqrt{k}\cdot (\frac{\varepsilon}{\varphi^2})^{1 / 3} + \frac{10^4\varepsilon}{\varphi^2}$
be the fraction of  $B$  in  $V$ . Since  $\frac{\varepsilon}{\varphi^2} < \frac{\gamma^3}{4^3 \cdot 10^9 \cdot k^{\frac{9}{2}} \cdot \log^3 k}$ , we have  $\kappa \leq 4\sqrt{k} \cdot \left(\frac{\varepsilon}{\varphi^2}\right)^{1/3} + \frac{10^4 \varepsilon}{\varphi^2} \leq \frac{\gamma}{10^3 k \log k} + \frac{\gamma^3}{4^3 \cdot 10^5 \cdot k^{\frac{9}{2}} \log^3 k} \leq \frac{2\gamma}{10^3 k \log k} = \frac{1}{50s}$ .
Therefore, by union bound, with probability at least  $1 - \kappa \cdot s \geq 1 - \frac{1}{50s} \cdot s = 1 - \frac{1}{50}$ , all the vertices in  $S$  are good (we fixed  $\alpha = \beta = 2\sqrt{k} \cdot \left(\frac{\varepsilon}{\varphi^2}\right)^{1/3}$ , so we will omit "with respect to  $\alpha$  and  $\beta$  in the following). In the following, we will assume all the vertices in  $S$  are good.
Recall that for  $i \in [k]$ ,  $|C_i| \geq \gamma \frac{n}{k}$ , so with probability at least  $1 - (1 - \frac{\gamma}{k})^s = 1 - (1 - \frac{1}{\frac{k}{\gamma}})^{\frac{k}{\gamma} \cdot 10 \log k} \geq 1 - \frac{1}{k^{10}} \geq 1 - \frac{1}{50k}$ , there exists at least one vertex in  $S$  that is from  $C_i$ . Then with probability at least  $1 - \frac{1}{50}$ , for all  $k$  clusters  $C_1, \ldots, C_k$ , there exists at least one vertex in  $S$  that is from  $C_i$ .
Let  $\xi = \frac{\sqrt{\gamma}}{1000}$ . By Lemma 2.1, we know that with probability at least  $1 - \frac{1}{n^{100}}$ , for any pair of  $x,y\in V$ , SPECTRALDOTPRODUCTORACLE $(G,x,y,1/2,\xi,\mathcal{D})$  computes an output value  $\langle f_x,f_y\rangle_{\mathrm{apx}}$  such that  $\left|\langle f_x,f_y\rangle_{\mathrm{apx}} - \langle f_x,f_y\rangle \right| \leq \frac{\xi}{n}$ . So, with probability at least  $1 - \frac{s\cdot s}{n^{100}} \geq 1 - \frac{1}{n^{50}}$ , for all pairs  $x,y \in S$ , SPECTRALDOTPRODUCTORACLE $(G,x,y,1/2,\xi,\mathcal{D})$  computes an output value  $\langle f_x,f_y\rangle_{\mathrm{apx}}$  such that  $\left|\langle f_x,f_y\rangle_{\mathrm{apx}} - \langle f_x,f_y\rangle \right| \leq \frac{\xi}{n}$ . In the following, we will assume the above inequality holds for any  $x,y \in S$ .
By Lemma 3.4, we know that if  $x, y$  are in the same cluster and both of them are good vertices, then we have  $\langle f_x, f_y \rangle \geq 0.96(1 - \frac{4\sqrt{\varepsilon}}{\varphi})\frac{1}{|C_i|} - \frac{\sqrt{k}}{n} \cdot (\frac{\varepsilon}{\varphi^2})^{1/6} \geq 0.96(1 - \frac{4\sqrt{\varepsilon}}{\varphi})\frac{\gamma k}{n} - \frac{\sqrt{k}}{n}(\frac{\varepsilon}{\varphi^2})^{1/6}$  since  $|C_i| \leq \frac{n}{\gamma k}$ . By Lemma 3.5, we know that if  $x, y$  are in the different clusters and both of them are good vertices, then we have  $\langle f_x, f_y \rangle \leq \frac{\sqrt{k}}{n} \cdot (\frac{\varepsilon}{\varphi^2})^{1/6} + \frac{\sqrt{2}k^{1/4}}{\sqrt{n}} \cdot (\frac{\varepsilon}{\varphi^2})^{1/3} \cdot \sqrt{(1 + \frac{4\sqrt{\varepsilon}}{\varphi})\frac{1}{|C_j|}} + \frac{8\sqrt{\varepsilon}}{\varphi} \cdot \frac{1}{\sqrt{|C_i| \cdot |C_j|}} \leq \frac{\sqrt{k}}{n} \cdot (\frac{\varepsilon}{\varphi^2})^{1/6} + \sqrt{\frac{2}{\gamma}}\frac{k^{3/4}}{n}\sqrt{1 + \frac{4\sqrt{\varepsilon}}{\varphi}} \cdot (\frac{\varepsilon}{\varphi^2})^{1/3} + \frac{8\sqrt{\varepsilon}}{\varphi} \cdot \frac{k}{\gamma n}$  since  $\frac{\gamma n}{k} \leq |C_i|$  for all  $i \in [k]$ .
Recall that  $\frac{\varepsilon}{\varphi^2} < \frac{\gamma^3}{4^3 \cdot 10^9 \cdot k^{\frac{9}{2}} \cdot \log^3 k}$  and  $\gamma \in (0.001, 1]$ . Let  $\theta = 0.96(1 - \frac{4\sqrt{\varepsilon}}{\varphi})\frac{\gamma k}{n} - \frac{\sqrt{k}}{n} (\frac{\varepsilon}{\varphi^2})^{1/6} - \frac{\xi}{n}$ , then we have  $\theta > \frac{\sqrt{\gamma}}{n} \cdot (0.96\sqrt{\gamma}k - \frac{0.48}{10^{9/2} \cdot k^{5/4} \log^{3/2} k} - \frac{1}{2 \cdot 10^{3/2} \cdot k^{1/4} \log^{1/2} k} - \frac{1}{1000}) > 0.034 \cdot \frac{\sqrt{\gamma}}{n}$ . Let  $S$  satisfies that all the vertices in  $S$  are good, and  $S$  contains at least one vertex from  $C_i$  for all  $i = 1, \ldots, k$ . For any  $x, y \in S$ , then:
1. If  $x, y$  belong to the same cluster, by above analysis, we know that  $\langle f_x, f_y \rangle \geq 0.96(1 - \frac{4\sqrt{\varepsilon}}{\varphi})\frac{\gamma k}{n} - \frac{\sqrt{k}}{n}\left(\frac{\varepsilon}{\varphi^2}\right)^{1/6}$ . Then it holds that  $\langle f_x, f_y \rangle_{\mathrm{apx}} \geq \langle f_x, f_y \rangle - \frac{\xi}{n} \geq 0.96\left(1 - \frac{4\sqrt{\varepsilon}}{\varphi}\right)\frac{\gamma k}{n} - \frac{\sqrt{k}}{n}\left(\frac{\varepsilon}{\varphi^2}\right)^{1/6} - \frac{\xi}{n} = \theta$ . Thus, an edge  $(x, y)$  will be added to  $H$  (at lines 8 and 9 of Alg.1).
2. If  $x, y$  belong to two different clusters, by above analysis, we know that  $\langle f_x, f_y \rangle \leq \frac{\sqrt{k}}{n} \cdot (\frac{\varepsilon}{\varphi^2})^{1/6} + \sqrt{\frac{2}{\gamma}} \frac{k^{3/4}}{n} \sqrt{1 + \frac{4\sqrt{\varepsilon}}{\varphi}} \cdot (\frac{\varepsilon}{\varphi^2})^{1/3} + \frac{8\sqrt{\varepsilon}}{\varphi} \cdot \frac{k}{\gamma n}$ . Then it holds that  $\langle f_x, f_y \rangle_{\mathrm{apx}} \leq \langle f_x, f_y \rangle + \frac{\xi}{n} \leq \frac{\sqrt{k}}{n} \cdot (\frac{\varepsilon}{\varphi^2})^{1/6} + \sqrt{\frac{2}{\gamma}} \frac{k^{3/4}}{n} \sqrt{1 + \frac{4\sqrt{\varepsilon}}{\varphi}} \cdot (\frac{\varepsilon}{\varphi^2})^{1/3} + \frac{8 \sqrt{\varepsilon}}{\varphi} \cdot \frac{k}{\gamma n} + \frac{\xi}{n} < \frac{\sqrt{\gamma}}{n} \cdot (\frac{1}{2 \cdot 10^{3/2} \cdot k^{1/4} \log^{1/2} k} + \frac{1}{2 \cdot 10^{3} \cdot k^{3/4} \log k} + \frac{1}{10^{9/2} \cdot k^{5/4} \log^{3/2} k} + \frac{1}{1000}) < 0.027 \cdot \frac{\sqrt{\gamma}}{n} < \theta$ , since  $\frac{\varepsilon}{\varphi^2} < \frac{\gamma^3}{4^3 \cdot 10^9 \cdot k^9 \cdot 2 \cdot 10^3 k}$  and  $\xi = \frac{\sqrt{\gamma}}{1000}$ . Thus, an edge  $(u, v)$  will not be added to  $H$ .
Therefore, with probability at least  $1 - \frac{1}{50} - \frac{1}{50} - \frac{1}{n^{50}} \geq 0.95$ , the similarity graph  $H$  has following properties: (1) all vertices in  $V(H)$  (i.e.,  $S$ ) are good; (2) all vertices in  $S$  that belong to the same cluster  $C_i$  form a connected component, denoted by  $S_i$ ; (3) there is no edge between  $S_i$  and  $S_j$ ,  $i \neq j$ ; (4) there are exactly  $k$  connected components in  $H$ , each corresponding to a cluster.
Now we are ready to consider a query WHICHCLUSTER  $(G,x)$
Assume  $x$  is good. We use  $C_x$  to denote the cluster that  $x$  belongs to. Since all the vertices in  $S$  are good, let  $y \in C_x \cap S$ , so with probability at least  $1 - \frac{s}{n^{100}} \geq 1 - \frac{1}{n^{50}}$ , by above analysis, we have  $\langle f_x, f_y \rangle_{\mathrm{apx}} \geq \langle f_x, f_y \rangle - \frac{\xi}{n} \geq \theta$ . On the other hand, for any  $y \in S \setminus C_x$ , with probability at least  $1 - \frac{s}{n^{100}} \geq 1 - \frac{1}{n^{50}}$ , by above analysis, we have  $\langle f_x, f_y \rangle_{\mathrm{apx}} \leq \langle f_x, f_y \rangle + \frac{\xi}{n} < \theta$ . Thus, WHICHCLUSTER( $G, x$ ) will output the label of  $y \in C_x \cap S$  as  $x' s$  label (at line 3 of Alg.2).
Therefore, with probability at least  $1 - \frac{1}{50} - \frac{1}{50} - \frac{1}{n^{50}} - \frac{n}{n^{50}} \geq 0.95$ , all the good vertices will be correctly recovered. So the misclassified vertices come from  $B$ . We know that  $|B| \leq \left(\alpha + \beta + \frac{10^4\varepsilon}{\varphi^2}\right) \cdot n = \left(4\sqrt{k} \cdot \left(\frac{\varepsilon}{\varphi^2}\right)^{1/3} + \frac{10^4\varepsilon}{\varphi^2}\right) \cdot n$ . Since  $|C_i| \geq \frac{\gamma n}{k}$ , we have  $n \leq \frac{k}{\gamma} |C_i|$ . So,  $|B| \leq (4\sqrt{k} \cdot (\frac{\varepsilon}{\varphi^2})^{1/3} + \frac{10^4\varepsilon}{\varphi^2}) \cdot \frac{k}{\gamma} |C_i| \leq O(\frac{k^{\frac{3}{2}}}{\gamma} \cdot (\frac{\varepsilon}{\varphi^2})^{1/3}) |C_i|$ . This implies that there exists a permutation  $\pi : [k] \to [k]$  such that for all  $i \in [k]$ ,  $|U_{\pi(i)} \triangle C_i| \leq O(\frac{k^{\frac{3}{2}}}{\gamma} \cdot (\frac{\varepsilon}{\varphi^2})^{1/3}) |C_i|$ .
Running time. By Lemma 2.1, we know that INITIALIZEORACLE $(G,1/2,\xi)$  computes in time  $\left(\frac{k}{\xi}\right)^{O(1)} \cdot n^{1/2 + O(\varepsilon/\varphi^2)} \cdot (\log n)^3 \cdot \frac{1}{\varphi^2}$  a sublinear space data structure  $\mathcal{D}$  and for every pair of vertices  $x,y \in V$ , SPECTRALDOTPRODUCTORACLE $(G,x,y,1/2,\xi,\mathcal{D})$  computes an output value  $\langle f_x,f_y\rangle_{\mathrm{apx}}$  in  $\left(\frac{k}{\xi}\right)^{O(1)} \cdot n^{1/2 + O(\varepsilon/\varphi^2)} \cdot (\log n)^2 \cdot \frac{1}{\varphi^2}$  time.
In preprocessing phase, for algorithm CONSTRUCTORACLE  $(G,k,\varphi ,\varepsilon ,\gamma)$ , it invokes INITIALIZEORACLE one time to construct a data structure  $\mathcal{D}$  and SPECTRALDOTPRODUCTORACLE  $s\cdot s$  times to construct a similarity graph  $H$ . So the preprocessing time of our oracle is  $(\frac{k}{\xi})^{O(1)}\cdot n^{1 / 2 + O(\varepsilon /\varphi^2)}\cdot (\log n)^3\cdot \frac{1}{\varphi^2} +\frac{100k^2\log^2k}{\gamma^2}\cdot (\frac{k}{\xi})^{O(1)}\cdot n^{1 / 2 + O(\varepsilon /\varphi^2)}\cdot (\log n)^2\cdot \frac{1}{\varphi^2} = O(n^{1 / 2 + O(\varepsilon /\varphi^2)}\cdot \mathrm{poly}(\frac{k\cdot\log n}{\gamma\varphi}))$
In query phase, to answer the cluster index that  $x$  belongs to, algorithm WHICHCLUSTER(G,x) invokes SPECTRALDOTPRODUCTORACLE  $s$  times. So the query time of our oracle is  $\frac{10k\log k}{\gamma} \cdot (\frac{k}{\xi})^{O(1)} \cdot n^{1/2 + O(\varepsilon/\varphi^2)} \cdot (\log n)^2 \cdot \frac{1}{\varphi^2} = O(n^{1/2 + O(\varepsilon/\varphi^2)} \cdot \mathrm{poly}(\frac{k \cdot \log n}{\gamma \varphi}))$ .
Space. By the proof of Lemma 2.1 in [14], we know that overall both algorithm INITIALIZEORACLE and SPECTRALDOTPRODUCTORACLE take  $\left(\frac{k}{\xi}\right)^{O(1)} \cdot n^{1/2 + O(\varepsilon/\varphi^2)} \cdot \mathrm{poly}(\log n)$  space. Therefore, overall preprocessing phase takes  $\left(\frac{k}{\xi}\right)^{O(1)} \cdot n^{1/2 + O(\varepsilon/\varphi^2)} \cdot \mathrm{poly}(\log n) = O(n^{1/2 + O(\varepsilon/\varphi^2)} \cdot \mathrm{poly}\left(\frac{k \log n}{\gamma}\right))$  space (at lines 5 and 7 of Alg.1). In query phase, WHICHCLUSTER query takes  $\left(\frac{k}{\xi}\right)^{O(1)} \cdot n^{1/2 + O(\varepsilon/\varphi^2)} \cdot \mathrm{poly}(\log n) = O(n^{1/2 + O(\varepsilon/\varphi^2)} \cdot \mathrm{poly}\left(\frac{k \log n}{\gamma}\right))$  space (at line 2 of Alg.2).
To evaluate the performance of our oracle, we conducted experiments on the random graph generated by the Stochastic Block Model (SBM). In this model, we are given parameters  $p$ ,  $q$  and  $n$ ,  $k$ , where  $n$ ,  $k$  denote the number of vertices and the number of clusters respectively;  $p$  denotes the probability that any pair of vertices within each cluster is connected by an edge, and  $q$  denotes the probability that any pair of vertices from different clusters is connected by an edge. Setting  $\frac{p}{q} > c$  for some big enough constant  $c$  we can get a well-clusterable graph. All experiments were implemented in Python 3.9 and the experiments were performed using an Intel(R) Core(TM) i7-12700F CPU @ 2.10GHz processor, with 32 GB RAM. Due to the limited space, practical changes to our oracle will be shown in Appendix F.
Misclassification error. To evaluate the misclassification error our oracle, we conducted this experiment. In this experiment, we set  $k = 3$ ,  $n = 3000$ ,  $q = 0.002$ ,  $p \in [0.02, 0.07]$  in the SBM, where each cluster has 1000 vertices. For each graph  $G = (V, E)$ , we run WHICHCLUSTER( $G, x$ ) for all  $x \in V$  and get a  $k$ -partition  $U_1, \ldots, U_k$  of  $V$ . In experiments, the misclassification error of our oracle is defined to be  $1 - \frac{1}{n} \cdot \max_{\pi} \sum_{i=1}^{k} U_{\pi(i)} \cap C_i$ , where  $\pi : [k] \to [k]$  is a permutation and  $C_1, \ldots, C_k$  are the ground-truth clusters of  $G$ .
Moreover, we implemented the oracle in [8] to compare with our oracle<sup>2</sup>. The oracle in [8] can be seen as a non-robust version of oracle in [30]. Note that our primary advancement over [8] (also [30]) is evident in the significantly reduced conductance gap we achieve.
2We remark that the oracle is implicit in [8] (see also [30]). Instead of using the inner product of spectral embeddings of vertex pairs, the authors of [8] used the pairwise  $\ell_2$ -distance between the distributions of two random walks starting from the two corresponding vertices.
We did not compare with the oracle in [14], since implementing the oracle in [14] poses challenges. As described in section 3.1, the oracle in [14] initially approximates the  $k$  cluster centers by sampling around  $O(1 / \varepsilon \cdot k^4\log k)$  vertices, and subsequently undertakes the enumeration of approximately  $2^{O(1 / \varepsilon \cdot k^4\log^2 k)}$  potential  $k$ -partitions (Algorithm 10 in [14]). This enumeration process is extremely time-intensive and becomes impractical even for modest values of  $k$ .
According to the result of our experiment (Table 1), the misclassification error of our oracle is reported to be quite small when  $p \geq 0.025$ , and even decreases to 0 when  $p \geq 0.035$ . The outcomes of our experimentation distinctly demonstrate that our oracle's misclassification error remains notably minimal in instances where the input graph showcases an underlying latent cluster structure. In addition, Table 1 also shows that our oracle can handle graphs with a smaller conductance gap than the oracle in [8], which is consistent with the theoretical results. This empirical validation reinforces the practical utility and efficacy of our oracle beyond theoretical conjecture.
Table 1: The misclassification error of the oracle in [8] and our oracle
p	0.02	0.025	0.03	0.035	0.04	0.05	0.06	0.07
min-error1([8])	-	0.5570	0.1677	0.0363	0.0173	0.0010	0	0
max-error1([8])	-	0.6607	0.6610	0.6533	0.4510	0.0773	0.0227	0.0013
average-error1([8])	-	0.6208	0.4970	0.1996	0.0829	0.0168	0.0030	0.0003
error (our)	0.2273	0.0113	0.0003	0	0	0	0	0
In the experiment, we found that the misclassification error of oracle in [8] fluctuated greatly, so for the oracle in [8], for each value of  $p$ , we conducted 30 independent experiments and recorded the minimum error, maximum error and average error of oracle in [8].