SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Ranran Shen*
ranranshen@mail.ustc.edu.cn
Pan Peng*
ppeng@ustc.edu.cn
We address the problem of designing a sublinear-time spectral clustering oracle for graphs that exhibit strong clusterability. Such graphs contain  $k$  latent clusters, each characterized by a large inner conductance (at least  $\varphi$ ) and a small outer conductance (at most  $\varepsilon$ ). Our aim is to preprocess the graph to enable clustering membership queries, with the key requirement that both preprocessing and query answering should be performed in sublinear time, and the resulting partition should be consistent with a  $k$ -partition that is close to the ground-truth clustering. Previous oracles have relied on either a poly  $(k)$  log  $n$  gap between inner and outer conductances or exponential (in  $k / \varepsilon$ ) preprocessing time. Our algorithm relaxes these assumptions, albeit at the cost of a slightly higher misclassification ratio. We also show that our clustering oracle is robust against a few random edge deletions. To validate our theoretical bounds, we conducted experiments on synthetic networks.
Graph clustering is a fundamental task in the field of graph analysis. Given a graph  $G = (V, E)$  and an integer  $k$ , the objective of graph clustering is to partition the vertex set  $V$  into  $k$  disjoint clusters  $C_1, \ldots, C_k$ . Each cluster should exhibit tight connections within the cluster while maintaining loose connections with the other clusters. This task finds applications in various domains, including community detection [32, 12], image segmentation [11] and bio-informatics [29].
However, global graph clustering algorithms, such as spectral clustering [27], modularity maximization [26], density-based clustering [10], can be computationally expensive, especially for large datasets. For instance, spectral clustering is a significant algorithm for solving the graph clustering problem, which involves two steps. The first step is to map all the vertices to a  $k$ -dimensional Euclidean space using the Laplacian matrix of the graph. The second step is to cluster all the points in this  $k$ -dimensional Euclidean space, often employing the  $k$ -means algorithm. The time complexity of spectral clustering, as well as other global clustering algorithms, is  $\mathrm{poly}(n)$ , where  $n = |V|$  denotes the size of the graph. As the graph size increases, the computational demands of these global clustering algorithms become impractical.
Addressing this challenge, an effective approach lies in the utilization of local algorithms that operate within sublinear time. In this paper, our primary focus is on a particular category of such algorithms designed for graph clustering, known as sublinear-time spectral clustering oracles [30, 14]. These algorithms consist of two phases: the preprocessing phase and the query phase, both of which can be executed in sublinear time. During the preprocessing phase, these algorithms sample a subset of vertices from  $V$ , enabling them to locally explore a small portion of the graph and gain insights into its cluster structure. In the query phase, these algorithms utilize the cluster structure learned during the preprocessing phase to respond to WHICHCLUSTER( $G, x$ ) queries. The resulting partition
$^{*}$ School of Computer Science and Technology, University of Science and Technology of China, Hefei, China. Corresponding author: Pan Peng.
defined by the output of WHICHCLUSTER  $(G,x)$  should be consistent with a  $k$ -partition that is close to the ground-truth clustering.
We study such oracles for graphs that exhibit strong clusterability, which are graphs that contain  $k$  latent clusters, each characterized by a large inner conductance (at least  $\varphi$ ) and a small outer conductance (at most  $\varepsilon$ ). Let us assume  $\varphi > 0$  is some constant. In [30] (see also [8]), a robust clustering oracle was designed with preprocessing time approximately  $O(\sqrt{n} \cdot \mathrm{poly}\left(\frac{k\log n}{\varepsilon}\right))$ , query time approximately  $O(\sqrt{n} \cdot \mathrm{poly}\left(\frac{k\log n}{\varepsilon}\right))$ , misclassification error (i.e., the number of vertices that are misclassified with respect to a ground-truth clustering) approximately  $O(kn\sqrt{\varepsilon})$ . The oracle relied on a poly  $(k)\log n$  gap between inner and outer conductance. In [14], a clustering oracle was designed with preprocessing time approximately  $2^{\mathrm{poly}\left(\frac{k}{\varepsilon}\right)}\mathrm{poly}(\log n) \cdot n^{1/2 + O(\varepsilon)}$ , query time approximately  $\mathrm{poly}\left(\frac{k\log n}{\varepsilon}\right) \cdot n^{1/2 + O(\varepsilon)}$ , misclassification error  $O(\log k \cdot \varepsilon)|C_i|$  for each cluster  $C_i$ ,  $i \in [k]$  and it takes approximately  $O(\mathrm{poly}\left(\frac{k}{\varepsilon}\right) \cdot n^{1/2 + O(\varepsilon)} \cdot \mathrm{poly}(\log n))$  space. This oracle relied on a log  $k$  gap between inner and outer conductance.
One of our key contributions in this research is a new sublinear-time spectral clustering oracle that offers enhanced preprocessing efficiency. Specifically, we introduce an oracle that significantly reduces both the preprocessing and query time, performing in  $\mathrm{poly}(k\log n)\cdot n^{1 / 2 + O(\varepsilon)}$  time and reduces the space complexity, taking  $O(\mathrm{poly}(k)\cdot n^{1 / 2 + O(\varepsilon)}\cdot \mathrm{poly}(\log n))$  space. This approach relies on a poly  $(k)$  gap between the inner and outer conductances, while maintaining a misclassification error of  $O(\mathrm{poly}(k)\cdot \varepsilon^{1 / 3})|C_i|$  for each cluster  $C_i,i\in [k]$ . Moreover, our oracle offers practical implementation feasibility, making it well-suited for real-world applications. In contrast, the clustering oracle proposed in [14] presents challenges in terms of implementation (mainly due to the exponential dependency on  $k / \varepsilon$ ).
We also investigate the sensitivity of our clustering oracle to edge perturbations. This analysis holds significance in various practical scenarios where the input graph may be unreliable due to factors such as privacy concerns, adversarial attacks, or random noises [31]. We demonstrate the robustness of our clustering oracle by showing that it can accurately identify the underlying clusters in the resulting graph even after the random deletion of one or a few edges from a well-clusterable graph.
Basic definitions. Graph clustering problems often rely on conductance as a metric to assess the quality of a cluster. Several recent studies ([8, 9, 30, 14, 22]) have employed conductance in their investigations. Hence, in this paper, we adopt the same definition to characterize the cluster quality. We state our results for  $d$ -regular graphs for some constant  $d \geq 3$ , though they can be easily generalized to graphs with maximum degree at most  $d$  (see Appendix B).
Definition 1.1 (Inner and outer conductance). Let  $G = (V, E)$  be a  $d$ -regular  $n$ -vertex graph. For a set  $S \subseteq C \subseteq V$ , we let  $E(S, C \setminus S)$  denote the set of edges with one endpoint in  $S$  and the other endpoint in  $C \setminus S$ . The outer conductance of a set  $C$  is defined to be  $\phi_{\mathrm{out}}(C, V) = \frac{|E(C, V \setminus C)|}{d|C|}$ . The inner conductance of a set  $C$  is defined to be  $\phi_{\mathrm{in}}(C) = \min_{S \subseteq C, 0 < |S| \leq \frac{|C|}{2}} \phi_{\mathrm{out}}(S, C) =$
$\min_{S \subseteq C, 0 < |S| \leq \frac{|C|}{2}} \frac{|E(S, C \setminus S)|}{d|S|}$  if  $|C| > 1$  and one otherwise. Specially, the conductance of graph  $G$  is defined to be  $\phi(G) = \min_{C \subseteq V, 0 < |C| \leq \frac{n}{2}} \phi_{\mathrm{out}}(C, V)$ .
Note that based on the above definition, for a cluster  $C$ , the smaller the  $\phi_{\mathrm{out}}(C,V)$  is, the more loosely connected with the other clusters and the bigger the  $\phi_{\mathrm{in}}(C)$  is, the more tightly connected within  $C$ . For a high quality cluster  $C$ , we have  $\phi_{\mathrm{out}}(C,V)\ll \phi_{\mathrm{in}}(C)\leq 1$ .
Definition 1.2 ( $k$ -partition). Let  $G = (V, E)$  be a graph. A  $k$ -partition of  $V$  is a collection of disjoint subsets  $C_1, \ldots, C_k$  such that  $\cup_{i=1}^{k} C_i = V$ .
Based on the above, we have the following definition of clusterable graphs.
Definition 1.3  $((k,\varphi ,\varepsilon)$  -clustering). Let  $G = (V,E)$  be a  $d$  -regular graph. A  $(k,\varphi ,\varepsilon)$  -clustering of  $G$  is a  $k$  -partition of  $V$  , denoted by  $C_1,\ldots ,C_k$  , such that for all  $i\in [k],\phi_{\mathrm{in}}(C_i)\geq \varphi ,\phi_{\mathrm{out}}(C_i,V)\leq$ $\varepsilon$  and for all  $i,j\in [k]$  one has  $\frac{|C_i|}{|C_j|}\in O(1)$  .  $G$  is called a  $(k,\varphi ,\varepsilon)$  -clusterable graph if there exists a  $(k,\varphi ,\varepsilon)$  -clustering of  $G$
Main results. Our main contribution is a sublinear-time spectral clustering oracle with improved preprocessing time for  $d$ -regular  $(k, \varphi, \varepsilon)$ -clusterable graphs. We assume query access to the adjacency list of a graph  $G$ , that is, one can query the  $i$ -th neighbor of any vertex in constant time.
Theorem 1. Let  $k \geq 2$  be an integer,  $\varphi \in (0,1)$ . Let  $G = (V,E)$  be a  $d$ -regular  $n$ -vertex graph that admits a  $(k,\varphi,\varepsilon)$ -clustering  $C_1, \ldots, C_k$ ,  $\frac{\varepsilon}{\varphi^2} \ll \frac{\gamma^3}{k^{\frac{9}{2}} \cdot \log^3 k}$  and for all  $i \in [k]$ ,  $\gamma_{k}^{\underline{n}} \leq |C_i| \leq \frac{n}{\gamma k}$ , where  $\gamma$  is a constant that is in (0.001, 1]. There exists an algorithm that has query access to the adjacency list of  $G$  and constructs a clustering oracle in  $O(n^{1/2 + O(\varepsilon/\varphi^2)} \cdot \mathrm{poly}\left(\frac{k \log n}{\gamma \varphi}\right))$  preprocessing time and takes  $O(n^{1/2 + O(\varepsilon/\varphi^2)} \cdot \mathrm{poly}\left(\frac{k \log n}{\gamma}\right))$  space. Furthermore, with probability at least 0.95, the following hold:
1. Using the oracle, the algorithm can answer any WHICHCLUSTER query in  $O(n^{1/2 + O(\varepsilon/\varphi^2)} \cdot \mathrm{poly}(\frac{k\log n}{\gamma\varphi}))$  time and a WHICHCLUSTER query takes  $O(n^{1/2 + O(\varepsilon/\varphi^2)} \cdot \mathrm{poly}(\frac{k\log n}{\gamma}))$  space.
2. Let  $U_{i} \coloneqq \{x \in V : \text{WHICHCLUSTER}(G, x) = i\}$ ,  $i \in [k]$  be the clusters recovered by the algorithm. There exists a permutation  $\pi : [k] \to [k]$  such that for all  $i \in [k]$ ,  $|U_{\pi(i)} \triangle C_{i}| \leq O\left(\frac{k^{\frac{3}{2}}}{\gamma} \cdot \left(\frac{\varepsilon}{\varphi^{2}}\right)^{1/3}\right)|C_{i}|$ .
Specifically, for every graph  $G = (V,E)$  that admits a  $k$ -partition  $C_1,\ldots ,C_k$  with constant inner conductance  $\varphi$  and outer conductance  $\varepsilon \ll O(\frac{1}{\mathrm{poly}(k)})$ , our oracle has preprocessing time  $\approx n^{1 / 2 + O(\varepsilon)}\cdot \mathrm{poly}(k\log n)$ , query time  $\approx n^{1 / 2 + O(\varepsilon)}\cdot \mathrm{poly}(k\log n)$ , space  $\approx O(n^{1 / 2 + O(\varepsilon /\varphi^2)} \cdot \mathrm{poly}(k\log n))$  and misclassification error  $\approx O(\mathrm{poly}(k)\cdot \varepsilon^{1 / 3})|C_i|$  for each cluster  $C_i,i\in [k]$ . In comparison to [30], our oracle relies on a smaller gap between inner and outer conductance (specifically  $O(\mathrm{poly}(k)\log n))$ . In comparison to [14], our oracle has a smaller preprocessing time and a smaller space at the expense of a slightly higher misclassification error of  $O(\mathrm{poly}(k)\cdot \varepsilon^{1 / 3})|C_i|$  instead of  $O(\log k\cdot \varepsilon)|C_i|$  and a slightly worse conductance gap of  $\varepsilon \ll O(\varphi^2 /\mathrm{poly}(k))$  instead of  $\varepsilon \ll O(\varphi^3 /\log (k))$ . It's worth highlighting that our space complexity significantly outperforms that of [14] (i.e.,  $O(n^{1 / 2 + O(\varepsilon /\varphi^2)}\cdot \mathrm{poly}(\frac{k}{\varepsilon}\cdot \log n)))$ , particularly in cases where  $k$  is fixed and  $\varepsilon$  takes on exceptionally small values, such as  $\varepsilon = \frac{1}{n^c}$  for sufficiently small constant  $c > 0$ , since the second term in our space complexity does not depend on  $\varepsilon$  in comparison to the one in [14].
Another contribution of our work is the verification of the robustness of our oracle against the deletion of one or a few random edges. The main idea underlying the proof is that a well-clusterable graph is still well-clusterable (with a slightly worse clustering quality) after removing a few random edges, which in turn is built upon the intuition that after removing a few random edges, an expander graph remains an expander. For the complete statement and proof of this claim, we refer to Appendix E.
Theorem 2 (Informal; Robust against random edge deletions). Let  $c > 0$  be a constant. Let  $G_0$  be a graph satisfying the similar conditions as stated in Theorem 1. Let  $G$  be a graph obtained from  $G_0$  by randomly deleting  $c$  edges. Then there exists a clustering oracle for  $G$  with the same guarantees as presented in Theorem 1.
Sublinear-time algorithms for graph clustering have been extensively researched. Czumaj et al. [8] proposed a property testing algorithm capable of determining whether a graph is  $k$ -clusterable or significantly far from being  $k$ -clusterable in sublinear time. This algorithm, which can be adapted to a sublinear-time clustering oracle, was later extended by Peng [30] to handle graphs with noisy partial information through a robust clustering oracle. Subsequent improvements to both the testing algorithm and the oracle were introduced by Chiplunkar et al. [6] and Gluchowski et al. [14]. Recently, Kapralov et al. [16, 17] presented a hierarchical clustering oracle specifically designed for graphs exhibiting a pronounced hierarchical structure. This oracle offers query access to a high-quality hierarchical clustering at a cost of  $\mathrm{poly}(k) \cdot n^{1/2 + O(\gamma)}$  per query. However, it is important to note that their algorithm does not provide an oracle for flat  $k$ -clustering, as considered in our work, with the same query complexity. Sublinear-time clustering oracles for signed graphs have also been studied recently [25].
The field of local graph clustering [33, 1, 3, 2, 34, 28] is also closely related to our research. In this framework, the objective is to identify a cluster starting from a given vertex within a running time
that is bounded by the size of the output set, with a weak dependence on  $n$ . Zhu et al. [34] proposed a local clustering algorithm that produces a set with low conductance when both inner and outer conductance are used as measures of cluster quality. It is worth noting that the running times of these algorithms are sublinear only if the target set's size (or volume) is small, for example, at most  $o(n)$ . In contrast, in our setting, the clusters of interest have a minimum size that is  $\Omega(n / k)$ .
Extensive research has been conducted on fully or partially recovering clusters in the presence of noise within the "global algorithm regimes". Examples include recovering the planted partition in the stochastic block model with modeling errors or noise [4, 15, 24, 21], correlation clustering on different ground-truth graphs in the semi-random model [23, 5, 13, 20], and graph partitioning in the average-case model [18, 19, 20]. It is important to note that all these algorithms require at least linear time to run.
Let  $G = (V, E)$  denote a  $d$ -regular undirected and unweighted graph, where  $V := \{1, \ldots, n\}$ . Throughout the paper, we use  $i \in [n]$  to denote  $1 \leq i \leq n$ . For any two vectors  $\mathbf{x}, \mathbf{y} \in \mathbb{R}^n$ , we let  $\langle \mathbf{x}, \mathbf{y} \rangle = \mathbf{x}^T \mathbf{y}$  denote the dot product of  $\mathbf{x}$  and  $\mathbf{y}$ . For a graph  $G$ , we let  $A \in \mathbb{R}^{n \times n}$  denote the adjacency matrix of  $G$  and let  $D \in \mathbb{R}^{n \times n}$  denote a diagonal matrix with  $D(i, i) = \deg(i)$ , where  $\deg(i)$  is the degree of vertex  $i, i \in [n]$ . We denote with  $L$  the normalized Laplacian of  $G$  where  $L = D^{-1/2}(D - A)D^{-1/2} = I - \frac{A}{d}$ . For  $L$ , we use  $0 \leq \lambda_1 \leq \ldots \leq \lambda_n \leq 2$  [7] to denote its eigenvalues and we use  $u_1, \ldots, u_n \in \mathbb{R}^n$  to denote the corresponding eigenvectors. Note that the corresponding eigenvectors are not unique, in this paper, we let  $u_1, \ldots, u_n$  be an orthonormal basis of eigenvectors of  $L$ . For any two sets  $S_1$  and  $S_2$ , we let  $S_1 \triangle S_2$  denote the symmetric difference between  $S_1$  and  $S_2$ .
Due to space constraints, we present only the key preliminaries here; the complete preliminaries will be presented in Appendix A.
Our algorithms in this paper are based on the properties of the dot product of spectral embeddings, so we also need the following definition.
Definition 2.1 (Spectral embedding). For a graph  $G = (V, E)$  with  $n = |V|$  and an integer  $2 \leq k \leq n$ , we use  $L$  denote the normalized Laplacian of  $G$ . Let  $U_{[k]} \in \mathbb{R}^{n \times k}$  denote the matrix of the bottom  $k$  eigenvectors of  $L$ . Then for every  $x \in V$ , the spectral embedding of  $x$ , denoted by  $f_x \in \mathbb{R}^k$ , is the  $x$ -row of  $U_{[k]}$ , which means  $f_x(i) = u_i(x), i \in [k]$ .
Definition 2.2 (Cluster centers). Let  $G = (V, E)$  be a  $d$ -regular graph that admits a  $(k, \varphi, \varepsilon)$ -clustering  $C_1, \ldots, C_k$ . The cluster center  $\mu_i$  of  $C_i$  is defined to be  $\mu_i = \frac{1}{|C_i|} \sum_{x \in C_i} f_x, i \in [k]$ .
The following informal lemma shows that the dot product of two spectral embeddings can be approximated in  $\widetilde{O}(n^{1/2 + O(\varepsilon/\varphi^2)} \cdot \mathrm{poly}(k))$  time.
Lemma 2.1 (Informal; Theorem 2, [14]). Let  $G = (V,E)$  be a  $d$ -regular graph that admits a  $(k,\varphi ,\varepsilon)$ -clustering  $C_1,\ldots ,C_k$ ,  $\varepsilon \leq \frac{\varphi^2}{10^5}$ . Then for every pair of vertices  $x,y \in V$ , SPECTRALDOTPRODUCT( $G,x,y,1/2,\xi,\mathcal{D}$ ) computes an output value  $\langle f_x,f_y\rangle_{\mathrm{apx}}$  in  $\widetilde{O}(n^{1/2+O(\varepsilon/\varphi^2)}\cdot\mathrm{poly}(k))$  time such that with high probability:  $\left|\langle f_x,f_y\rangle_{\mathrm{apx}} - \langle f_x,f_y\rangle\right| \leq \frac{\xi}{n}$ .
For the completeness of this paper, we will show the formal Lemma 2.1 and algorithm SPECTRALDOTPRODUCT $(G,x,y,1/2,\xi,\mathcal{D})$  in Appendix C.
3 Spectral clustering oracle
3.1 Our techniques
We begin by outlining the main concepts of the spectral clustering oracle presented in [14]. Firstly, the authors introduce a sublinear time oracle that provides dot product access to the spectral embedding of graph  $G$  by estimating distributions of short random walks originating from vertices in  $G$  (as described in Lemma 2.1). Subsequently, they demonstrate that (1) the set of points corresponding to the spectral embeddings of all vertices exhibits well-concentrated clustering around the cluster center  $\mu_{i}$  (refer to Definition 2.2), and (2) all the cluster centers are approximately orthogonal to each other. The clustering oracle in [14] operates as follows: it initially guesses the  $k$  cluster centers from a set of
Figure 1: The angle between embeddings of vertices in the same cluster is small and the angle between embeddings of vertices in different clusters is close to orthogonal ( $k = 3$ ).
poly  $(k / \varepsilon)$  sampled vertices, which requires a time complexity of  $2^{\mathrm{poly}(k / \varepsilon)}n^{1 / 2 + O(\varepsilon)}$ . Subsequently, it iteratively employs the dot product oracle to estimate  $\langle f_x,\mu_i\rangle$ . If the value of  $\langle f_x,\mu_i\rangle$  is significant, it allows them to infer that vertex  $x$  likely belongs to cluster  $C_i$ .
Now we present our algorithm, which builds upon the dot product oracle in [14]. Our main insight is to avoid relying directly on cluster centers in our algorithm. By doing so, we can eliminate the need to guess cluster centers and consequently remove the exponential time required in the preprocessing phase described in [14]. The underlying intuition is as follows: if two vertices,  $x$  and  $y$ , belong to the same cluster  $C_i$ , their corresponding spectral embeddings  $f_x$  and  $f_y$  will be close to the cluster center  $\mu_i$ . As a result, the angle between  $f_x$  and  $f_y$  will be small, and the dot product  $\langle f_x, f_y \rangle$  will be large (roughly on the order of  $O\left(\frac{k}{n}\right)$ ). Conversely, if  $x$  and  $y$  belong to different clusters, their embeddings  $f_x$  and  $f_y$  will tend to be orthogonal, resulting in a small dot product  $\langle f_x, f_y \rangle$  (close to 0). We prove that this desirable property holds for the majority of vertices in  $d$ -regular  $(k, \varphi, \varepsilon)$ -clusterable graphs (see Figure 1 for an illustrative example). Slightly more formally, we introduce the definitions of good and bad vertices (refer to Definition 3.1) such that the set of good vertices corresponds to the core part of clusters and each pair of good vertices satisfies the aforementioned property; the rest vertices are the bad vertices. Leveraging this property, we can directly utilize the dot product of spectral embeddings to construct a sublinear clustering oracle.
Based on the desirable property discussed earlier, which holds for  $d$ -regular  $(k,\varphi ,\varepsilon)$ -clusterable graphs, we can devise a sublinear spectral clustering oracle. Let  $G = (V,E)$  be a  $d$ -regular  $(k,\varphi ,\varepsilon)$ -clusterable graph that possesses a  $(k,\varphi ,\varepsilon)$ -clustering  $C_1,\ldots ,C_k$ . In the preprocessing phase, we sample a set  $S$  of  $s$  vertices from  $V$  and construct a similarity graph, denoted as  $H$ , on  $S$ . For each pair of vertices  $x,y\in S$ , we utilize the dot product oracle from [14] to estimate  $\langle f_x,f_y\rangle$ . If  $x$  and  $y$  belong to the same cluster  $C_i$ , yielding a large  $\langle f_x,f_y\rangle$ , we add an edge  $(x,y)$  to  $H$ . Conversely, if  $x$  and  $y$  belong to different clusters, resulting in a  $\langle f_x,f_y\rangle$  close to 0, we make no modifications to  $H$ . Consequently, only vertices within the same cluster  $C_i(i\in [k])$  can be connected by edges. We can also establish that, by appropriately selecting  $s$ , the sampling set  $S$  will, with high probability, contain at least one vertex from each  $C_1,\ldots ,C_k$ . Thus, the similarity graph  $H$  will have  $k$  connected components, with each component corresponding to a cluster in the ground-truth. We utilize these  $k$  connected components, denoted as  $S_{1},\ldots ,S_{k}$ , to represent  $C_1,\ldots ,C_k$ .
During the query phase, we determine whether the queried vertex  $x$  belongs to a connected component in  $H$ . Specifically, we estimate  $\langle f_x, f_y \rangle$  for all  $y \in S$ . If there exists a unique index  $i \in [k]$  for which  $\langle f_x, f_u \rangle$  is significant (approximately  $O\left(\frac{k}{n}\right)$ ) for all  $u \in S_i$ , we conclude that  $x$  belongs to cluster  $C_i$ , associated with  $S_i$ . If no such unique index is found, we assign  $x$  a random index  $i$ , where  $i \in [k]$ .
3.2 The clustering oracle
Next, we present our algorithms for constructing a spectral clustering oracle and handling the WHICH-CLUSTER queries. In the preprocessing phase, the algorithm CONSTRUCTORACLE  $(G,k,\varphi ,\varepsilon ,\gamma)$  learns the cluster structure representation of  $G$ . This involves constructing a similarity graph  $H$  on a sampled vertex set  $S$  and assigning membership labels  $\ell$  to all vertices in  $S$ . During the query phase, the algorithm WHICHCLUSTER  $(G,x)$  determines the clustering membership index to which vertex  $x$  belongs. More specifically, WHICHCLUSTER  $(G,x)$  utilizes the function SEARCHINDEX  $(H,\ell ,x)$