SlowGuess/NeurIPS_2023_OCR huggingface dataset:
where  $\mathbf{W}_G\in \mathbb{R}^{E\times E}$  is the diagonal matrix of weights in  $G$  [5].
Runtimes and Space Complexities. In our algorithmic results and analysis, when clear from context, we use  $\widetilde{O}(\cdot)$  (resp.,  $\widetilde{\Omega}(\cdot)$ ) notation to hide polylogarithmic factors (resp., inverse polylogarithmic factors) in the number of vertices, the number of edges, the size of the matrix, the number of nonzero entries in a matrix, the maximum and minimum diagonal element of a matrix, the maximum and minimum weighted degree of a graph,  $\epsilon$ , the condition number, and the normalized psuedo-condition number of a matrix. We say event  $E$  occurs with high probability in  $t$  if  $\mathbb{P}[E] \geqslant 1 - t^{-c}$ , where  $c > 0$  can be controlled by appropriately configuring the algorithm parameters. We may simply say that an event occurs "with high probability" or "whp." if it occurs with high probability in the size of a matrix or number of nodes in a graph.
3 Algorithmic Results
In this section, we present our main algorithmic results. Section 3.1 outlines our approach to effective resistance sketches and estimation; we defer discussion of our approach to SDD and PSD extensions to the supplementary material. Section 3.2, presents our original results on effective resistance sketching and estimation and generalizations to SDD matrices. Section 3.3 extends our techniques to yield an interesting data structure for estimating quadratic forms of PSD matrices.
3.1 Our Approach
Approach in prior work: Johnson Lindenstrauss sketches. Our starting inspiration is a classic result of [5], which obtains an  $(\widetilde{O}(m\epsilon^{-2}), \widetilde{O}(\epsilon^{-2}), \widetilde{O}(n\epsilon^{-2}))$ -effective resistance sketch by using the Johnson Lindenstrauss Lemma (JL) [39] and its algorithmic instantiations [40].
Lemma 1 (Johnson-Lindenstrauss Lemma [40]). Given fixed vectors  $v_{1}, \ldots, v_{n} \in \mathbb{R}^{d}$  and  $\epsilon \in (0,1)$ , let  $\mathbf{J}$  be an independently sampled random matrix in  $\{\pm 1 / \sqrt{k}\}^{k \times d}$ . For  $k = \widetilde{O}(\log(n)\epsilon^{-2})$ , whp. in  $n$ ,  $\| \mathbf{J}v_{i}\|_{2} \approx_{\epsilon} \| v_{i}\|_{2}$  for all  $i \in [n]$ .
[5] observe that  $r_G(i,j) = (\mathbf{W}_G^{1/2}\mathbf{B}_G\mathbf{L}_G^\dagger \vec{\delta}_{i,j})^\top (\mathbf{W}_G^{1/2}\mathbf{B}_G\mathbf{L}_G^\dagger \vec{\delta}_{i,j})$ . Consequently, w.h.p in  $n$ ,  $\| \mathbf{J}\mathbf{W}_G^{1/2}\mathbf{B}_G\mathbf{L}_G^\dagger \vec{\delta}_{i,j}\|_2 \approx_\epsilon r_G(i,j)$ . With SDD linear system solvers,  $\mathbf{J}\mathbf{W}_G^{1/2}\mathbf{B}_G\mathbf{L}_G^\dagger$  can be approximated in  $\widetilde{O}(m\epsilon^{-1})$  time, from which  $\| \mathbf{J}\mathbf{W}_G^{1/2}\mathbf{B}_G\mathbf{L}_G^\dagger \vec{\delta}_{i,j}\|_2$  can be queried in  $\widetilde{O}(\epsilon^{-2})$  time.
Our approach: asymmetric CountSketch in  $\ell_1$ . Towards improving upon JL sketches for effective resistance estimation, our key tool is to use other sketching algorithms. In particular we use that there are algoirths that achieve better than  $\widetilde{O}(\epsilon^{-2})$ -sketch dimension for vectors with small  $\ell_1$  norm with comparable guarantees, e.g., CountSketch. CountSketch is a classic memory-efficient algorithm for estimating the number of occurrences of various datapoints in a data stream [41] and efficiently computing inner products [42]. Given  $v \in \mathbb{R}^n$  and integer parameters  $s, t > 0$ , CountSketch transforms  $v$  to a vector  $\mathbf{S}v \in \mathbb{R}^{3ts \times n}$ , where  $\mathbf{S} \in \mathbb{R}^{3ts \times n}$  is a  $3t$ -column-sparse  $0/1$  matrix. Lemma 2 is a special case of Theorem 4 from [42], which provides accuracy guarantees for inner product estimation using CountSketch.
Lemma 2 (Special Case of [42], Theorem 4). Let vectors  $v, w \in \mathbb{R}^n$ . Let  $\mathbf{S}$  be a random CountSketch matrix. Let  $x_i = \langle (\mathbf{S}v)[(i - 1)s + 1 : i \cdot s], (\mathbf{S}w)[(i - 1)s + 1 : i \cdot s] \rangle$  for  $i \in [3t]$ , and let  $X$  denote the median of  $\{x_i\}$ . For  $s = O\left(\min\left(\frac{\|v\|_1 \|w\|_1}{\epsilon|\langle v, w\rangle|}, \frac{\|v\|_2 \|w\|_2^2}{\epsilon^2 |\langle v, w\rangle|^2}\right)\right)$ , and  $t = \log(n^c)$ ,  $|X - \langle v, w \rangle| \leqslant \epsilon |\langle v, w \rangle|$  with probability at least  $\Omega(1 - n^{-c})$ .
To improve the guarantee in Lemma 2 to hold whp. for all  $v, w \in S$  rather than for each fixed pair, one can simply choose  $t = \log (n^c |S|)$  and apply a union bound. Consequently, if we knew that  $\| \mathbf{W}_G^{1/2} \mathbf{B}_G \mathbf{L}_G^\dagger \vec{\delta}_{i,j} \|_1^2 / r_G(i,j) = \widetilde{O}(1)$ , then building a CountSketch with  $s = \widetilde{O}(\epsilon^{-1})$  would
yield a  $\widetilde{O}(n\epsilon^{-1})$ -size sketch, improving over the  $\widetilde{O}(n\epsilon^{-2})$  sketch obtained using the  $\ell_2$  JL sketch in [5]. Unfortunately, it is unclear if and when such a bound holds, and so, it is unclear how the  $\ell_1$  CountSketches could be useful in this setting. This leads to the main insight that fuels our algorithms. Rather than seeking a symmetric factorization of  $r_G(i,j)$  as a quadratic form  $v^\top v$  and applying a sketching procedure to  $v$ , we instead work with an asymmetric factorization. In particular, we observe
$$
r _ {G} (i, j) = \left\langle \mathbf {D} _ {\mathbf {L} _ {G}} ^ {- 1} \vec {\delta} _ {i, j}, \mathbf {D} _ {\mathbf {L}} ^ {1 / 2} \left(\mathbf {N} _ {\mathbf {L} _ {G}}\right) ^ {\dagger} \mathbf {D} _ {\mathbf {L} _ {G}} ^ {- 1 / 2} \vec {\delta} _ {i, j} \right\rangle . \tag {1}
$$
At first glance, it may seem unclear why (1) is helpful. However, we show that indeed, for expanders
$$
\left\| \mathbf {D} _ {\mathbf {L}} ^ {- 1} \vec {\delta} _ {i, j} \right\| _ {1} \left\| \mathbf {D} _ {\mathbf {L}} ^ {1 / 2} \left(\mathbf {N} _ {\mathbf {L}}\right) ^ {\dagger} \mathbf {D} _ {\mathbf {L}} ^ {- 1 / 2} \vec {\delta} _ {i, j} \right\| _ {1} / r _ {G} (i, j) = \widetilde {O} (1). \tag {2}
$$
Our main result essentially follows from (2). Using SDD linear system solvers, we can efficiently approximate  $\mathbf{SD}_{\mathbf{L}}^{1/2}(\mathbf{N}_{\mathbf{L}})^{\dagger}\mathbf{D}_{\mathbf{L}}^{-1/2} \in \mathbb{R}^{\widetilde{O}(\epsilon^{-1}) \times n}$  in  $\widetilde{O}(m\epsilon^{-1})$  time, yielding our  $\mathcal{T}_{\mathrm{q}}$  of  $\widetilde{O}(m\epsilon^{-1})$  and  $s$  of  $\widetilde{O}(n\epsilon^{-1})$  (see discussion in supplementary material). Moreover,  $\mathbf{SD}_{\mathbf{L}}^{-1}$  is  $\widetilde{O}(1)$ -sparse, due to the structure of Count-Sketch. So, using our (approximate) access to  $\mathbf{SD}_{\mathbf{L}}^{1/2}(\mathbf{N}_{\mathbf{L}})^{\dagger}\mathbf{D}_{\mathbf{L}}^{-1/2}$ , for any query  $i, j \in V$ , we can efficiently approximate (1) using the recovery procedure of Lemma 2 in  $\widetilde{O}(1)$  time.
3.2 Our Results
We use the approach in Section 3.1 to develop algorithms to compute spectral sketch data structures for SDD matrices  $\mathbf{M}$  with  $\widetilde{O}(1)$  normalized condition number, as defined in Definitions 6 and 7. So, as discussed in Section 2, this implies that our spectral sketch algorithms will automatically apply to normalized Laplacians of expanders and enable us to compute effective resistances.
Definition 7 (Spectral Sketch Data Structure). We say an algorithm produces an  $(\mathcal{T}_{\mathrm{s}},\mathcal{T}_{\mathrm{q}},s)$ -spectral sketch data structure for a PSD matrix  $\mathbf{A}\in \mathbb{R}^{n\times n}$  if given  $\mathbf{A}\in \mathbb{R}^{n\times n}$  and  $\epsilon \in (0,1)$ , the algorithm creates a binary string of length  $O(s(A,\epsilon))$  in time  $O(\mathcal{T}_{\mathrm{s}}(A,\epsilon))$ , from which, for any supported query  $b\in \mathbb{R}^n$ , w.h.p it outputs  $q_{A}(b)\approx_{\epsilon}b^{\top}\mathbf{A}b$  in time  $O(\mathcal{T}_{\mathrm{q}}(A,\epsilon)(\mathrm{nnz}(b))^2)$ .
Our spectral sketches of SDD matrices  $\mathbf{M}$  will only support  $\mathbf{D}_M$ -numerically sparse query vectors.
Definition 8 (D-numerically sparse). For a diagonal matrix  $\mathbf{D}$ , the  $\mathbf{D}$ -numerical sparsity of  $x \in \mathbb{R}^n$  is  $\mathrm{ns}_{\mathbf{D}}(x) := \left\| \mathbf{D}^{-1} x \right\|_1 \| x \|_1 / \left\| \mathbf{D}^{-1/2} x \right\|_2^2$ . We say  $x$  is  $(c, \mathbf{D})$ -numerically sparse if  $\mathrm{ns}_{\mathbf{D}}(x) \leqslant c$ .
Definition 8 is restrictive; however, several natural classes of vectors satisfy the requirements. For example,  $\mathbb{1}_i$  are  $(1,\mathbf{D})$ -numerically sparse and  $\vec{\delta}_{i,j}$  is  $(2,\mathbf{D}_M)$ -numerically sparse for any  $i,j\in [n]$  and invertible diagonal matrix  $\mathbf{D}\in \mathbb{R}^{n\times n}$  (see supplementary material for additional examples.)
The following asymmetric rearrangement of quadratic forms is crucial to our analysis.
Lemma 3. Let  $\mathbf{M} \in \mathbb{R}^{n \times n}$  be SDD and  $x \in \mathbb{R}^n$  be orthogonal to  $\ker (\mathbf{M})$ . Then,
$$
x ^ {\top} \mathbf {M} ^ {\dagger} x = \frac {1}{2} \left\langle \mathbf {D} _ {M} ^ {- 1} x, \mathbf {D} _ {M} ^ {1 / 2} (\mathbf {N} _ {M} / 2) ^ {\dagger} \mathbf {D} _ {M} ^ {- 1 / 2} x \right\rangle = \left\langle \mathbf {D} _ {M} ^ {- 1 / 2} x, \mathbf {N} _ {M} ^ {\dagger} \mathbf {D} _ {M} ^ {- 1 / 2} x \right\rangle \geqslant \frac {1}{2} \left\| \mathbf {D} _ {M} ^ {- 1 / 2} x \right\| _ {2} ^ {2}.
$$
Proof. For notational convenience, let  $\mathbf{N}_{\ell M} = \mathbf{N}_M / 2$ . Let  $v = \mathbf{M}^{\dagger}x = (\mathbf{D}_M - \mathbf{A}_M)^{\dagger}x$ . Note that  $\mathbf{D}_M^{-1/2}x \perp \ker(\mathbf{N}_M)$ , and  $2\mathbf{D}_M^{1/2}\mathbf{N}_{\ell M}\mathbf{D}_M^{1/2} = \mathbf{M}$ . Consequently,  $v = \frac{1}{2}\mathbf{D}_M^{-1/2}\mathbf{N}_{\ell M}^{\dagger}\mathbf{D}_M^{-1/2}x$ , and hence  $x^{\top}\mathbf{M}^{\dagger}x = \frac{1}{2}\langle \mathbf{D}_M^{-1}x, \mathbf{D}_M^{1/2}\mathbf{N}_{\ell M}^{\dagger}\mathbf{D}_M^{-1/2}x \rangle$ . The second equality now follows immediately by rearranging terms. To obtain the inequality, note that, because  $\mathbf{M}$  is SDD and  $\mathbf{D}$  is invertible,  $\mathbf{N}_M$  is PSD. Furthermore,  $2\mathbf{I} - \mathbf{N}_M = \mathbf{I} - \mathbf{D}_M^{-1/2}\mathbf{A}_M\mathbf{D}_M^{-1/2}$ , which is also PSD, as  $\lambda(\mathbf{A}_M) \subset [-d_{\max}, d_{\max}]$ . So,  $0 \leqslant \lambda(\mathbf{N}_M) \leqslant 2$ . So,  $\lambda_{\min}(\mathbf{N}_M) \geqslant 1/2$  and the lemma follows.
Lemma 4 bounds  $\left\| \mathbf{D}_M^{1 / 2}(\mathbf{N}_M / 2)^\dagger \mathbf{D}_M^{-1 / 2}x\right\| _1$ . The proof uses the power series expansion of  $(\mathbf{N}_M / 2)^\dagger$
Lemma 4. Let  $\mathbf{M} \in \mathbb{R}^{n \times n}$  be an SDD matrix and  $x \in \mathbb{R}^n$  be a unit vector orthogonal to  $\ker(\mathbf{M})$ . Then
$$
\left\| \mathbf {D} _ {M} ^ {1 / 2} (\mathbf {N} _ {M} / 2) ^ {\dagger} \mathbf {D} _ {M} ^ {- 1 / 2} x \right\| _ {1} \leqslant \max \left(1, 2 \bar {\kappa} (\mathbf {M}) \log \left(\sqrt {n d _ {\mathrm {m a x}}} 2 \bar {\kappa} (\mathbf {M}) / \sqrt {d _ {\mathrm {m i n}}}\right)\right) \| x \| _ {1} + 1.
$$
Combining our Lemmas 3 and 4 with the guarantees of Lemma 2 and prior work on SDD linear system solvers (see supplementary material), we obtain the following theorem.
Theorem 7. For any SDD matrix  $\mathbf{M} \in \mathbb{R}^{n \times n}$ , there is an algorithm to construct an  $(\widetilde{O}(\bar{\kappa}(\mathbf{M}) \mathrm{nnz}(\mathbf{M})\epsilon^{-1}), \widetilde{O}(1), \widetilde{O}(\bar{\kappa}(\mathbf{M}) n\epsilon^{-1}))$ -spectral sketch data structure of  $\mathbf{M}^{\dagger}$  supported over queries  $S$ , where  $S$  is any set of  $(\widetilde{O}(1), \mathbf{D}_M)$ -numerically sparse vectors orthogonal to  $\ker(\mathbf{M})$ .
Because the  $\vec{\delta}_{i,j}$  queries appearing in effective resistance computations are 2-sparse and  $(2, \mathbf{D}_M)$ -numerically sparse for all SDD matrices  $\mathbf{M}$ , taking  $\mathbf{M} = \mathbf{L}_G$  in Theorem 7 immediately implies Theorem 2 and Theorem 3 (see supplementary material for detailed discussion and pseudocode.)
3.3 Extensions to PSD Matrices
Our approach of approximating quadratic forms via asymmetric inner products also yields a query-efficient sketching procedure for approximating quadratic forms of well-conditioned PSD matrices.
Theorem 8. There is an algorithm to construct an  $(\widetilde{O} (\kappa (\mathbf{A})\mathrm{nnz}(\mathbf{A})\epsilon^{-2}),\widetilde{O} (1),\widetilde{O} (\kappa (\mathbf{A})n\epsilon^{-2}))$  spectral sketch data structure of  $\mathbf{A}$  supported over  $S$ , where  $S$  is any set of vectors orthogonal to  $\ker (\mathbf{A})$  and  $\mathbf{A}$  is PSD.
In comparison, JL [39] gives an  $(\widetilde{O}(n^{\omega}), \widetilde{O}(\epsilon^{-2}), \widetilde{O}(n\epsilon^{-2}))$ -spectral sketch data structure using efficient square root algorithms [43]. JL achieves better compression than Theorem 8, while Theorem 8 achieves faster query time. When the matrix is well conditioned and error tolerance is sufficiently high, Theorem 8 may achieve better construction time and query time than JL while maintaining comparable compression.
4 Lower Bounds
In this section, we present our main hardness results. Section 4.1 outlines our approach. In Section 4.2, we present our lower bounds for the problem of estimating effective resistances for all pairs of nodes (case where  $S = V \times V$ ), which we call the "all pairs effective resistance estimation problem." Section 4.3 shows our techniques also yield lower bounds for other spectral sum estimation problems.
4.1 Our Approach
Approaches of Previous Work The approach of [33] begins with the fact that  $G$  has a triangle if and only if  $\operatorname{tr}(\mathbf{A}_G^3) / 6 \geqslant 1$ . They use the fact that various spectral sums  $\mathcal{S}_f$  of the SDD matrix  $\mathbf{I} - \delta \mathbf{A}_G$  (for  $\delta$  sufficiently small) can be expressed as a power series  $\mathcal{S}_f(\mathbf{I} - \delta \mathbf{A}_G) = \sum_{k=0}^{\infty} c_k \delta^k \operatorname{tr}(\mathbf{A}_G^k)$ . The first two terms of this series can be computed directly. So given  $Y \approx_{\epsilon} \mathcal{S}_f(\mathbf{I} - \delta \mathbf{A}_G)$ , one can estimate  $\operatorname{tr}(\mathbf{A}_G^3)$ , where the estimation error is controlled by the magnitude of the first two terms of the series and the tail error due to truncating at the third term. By bounding this estimation error, [33] show that, for appropriate choices of  $\delta$ ,  $Y \approx_{\epsilon} \mathcal{S}_f(\mathbf{I} - \delta \mathbf{A}_G)$  yields an additive  $1/2$  approximation to  $\operatorname{tr}(\mathbf{A}_G^3)$ , which is sufficient for triangle detection. They also reduce the problem of estimating the spectral sum  $\operatorname{tr}(\mathbf{B}^{-1})$  for an SDD matrix  $\mathbf{B}$  to the all pairs effective resistance estimation problem.
Our Approach We use three key techniques to better bound the estimation errors incurred in the power-series-inspired approach of [33]. This yields faster reductions and better lower bounds for effective resistance estimation. Rather than obtaining effective resistance lower bounds by reducing the problem of computing  $\operatorname{tr}\left(\mathbf{A}_G^3\right) / 6$  to computing the trace of an SDD matrix as in [33], we use a reduction that closely resembles the structure of effective resistances. For  $\alpha >0$  sufficiently small,
$$
\left(\mathbf {I} - \frac {\alpha}{n} \mathbf {A} _ {G}\right) ^ {- 1} = \sum_ {k = 0} ^ {\infty} \frac {\alpha^ {k}}{n ^ {k}} \mathbf {A} _ {G} ^ {k}. \tag {3}
$$
Since  $\mathbf{A}_G$  is known, given access to  $\vec{\delta}_{i,j}^{\top}(\mathbf{I} - \frac{\alpha}{n}\mathbf{A}_G)^{-1}\vec{\delta}_{i,j}$ , we can estimate the entries of  $\mathbf{A}_G^2$ , where the estimation error is controlled by  $\alpha$  and the tail error of truncating (3) at the third term. By bounding this estimation error, for appropriate choice of  $\alpha$ , we can obtain additive 1/2 approximations to all entries of  $\mathbf{A}_G^2$ , which is sufficient to identify all paths of length 2. We can then detect a
triangle by simply scanning for an edge  $\{u, v\}$  such that  $u$  and  $v$  are connected by a path of length 2. Estimating the entries of  $\mathbf{A}_G^2$  leads to lower estimation error than estimating  $\operatorname{tr}(\mathbf{A}_G^3)$  as in [33]). Second, we use a standard randomized reduction that reduces the triangle detection problem to the triangle detection problem restricted to tripartite graphs. The reduction relies on the fact that a randomly sampled tripartition of the original graph preserves triangles with constant probability. To detect a triangle in a tripartite graph  $G = (V_1 \sqcup V_2 \sqcup V_3, E)$ , we construct a graph  $H$  by removing all edges  $E_{1,2} := \{\{u, v\} \in E : u \in V_1, v \in V_2\}$  between  $V_1$  and  $V_2$ .  $G$  has a triangle if and only if there is an edge  $\{u, v\} \in E_{1,2}$  and a path of length 2 between  $u$  and  $v$  in  $H$ . Crucially, we can show that the third term  $\bar{\mathbf{A}}_H^3$  does not contribute to the tail error when estimating the  $\{u, v\}$ -th entry of  $(\mathbf{A}_H^2)$  using (3). Third, to lower the spectral norm of  $\mathbf{A}_H$  (and consequently better bound the convergence of the power series (3)), we introduce the symmetric random signing of  $\mathbf{A}_H$  below.
Definition 9 (Symmetric Random Signing). Given a symmetric matrix  $\mathbf{A} \in \mathbb{R}^{n \times n}$ , its symmetric random signing  $\bar{\mathbf{A}}$  is the random matrix with  $\bar{\mathbf{A}}_{i,j} \coloneqq \xi_{i,j} \mathbf{A}_{i,j}$ , where  $\xi_{i,j}$  are independent Rademacher random variables that satisfy  $\xi_{i,j} = \xi_{j,i}$ .
We show that this random signing preserves the non-zeroness of entries of  $\mathbf{A}_H^2$  with constant probability, allowing us to detect whether  $G$  has a triangle even if we replace  $\mathbf{A}_G$  in (3) with  $\bar{\mathbf{A}}_H$  instead. This is beneficial, as matrix Chernoff guarantees  $\| \bar{\mathbf{A}}_H\| _2 = \tilde{O} (\sqrt{n})$  whp. whereas  $\| \mathbf{A}_H\| _2$  may be as large as  $n$ . So the tail error of truncating the power series is smaller. To compute entries of  $\bar{\mathbf{A}}_H^2$  efficiently using effective resistance estimates on expanders, we first show that we can use all pairs effective resistance estimates on expanders to estimate  $\vec{\delta}_{i,j}^{T}\mathbf{M}^{-1}\vec{\delta}_{i,j}$  for all  $i,j\in [n]$ , where  $\mathbf{M} = (\mathbf{I} - \mathbf{Q})$  is an SDD matrix with  $\rho (\mathbf{Q})\leqslant 1 / 3$ . Then, by choosing  $\mathbf{M} = \mathbf{I} - \frac{\alpha}{n}\bar{\mathbf{A}}_H$  as in (3) for an appropriate constant  $\alpha$ , we can estimate  $\bar{\mathbf{A}}_H^2$  from estimates of  $\vec{\delta}_{i,j}^{T}\mathbf{M}^{-1}\vec{\delta}_{i,j}$ . This yields our lower bound on the all pairs effective resistance estimation problem.
Additionally, we show that random signing also preserves the non-zeroness of  $\operatorname{tr}\left(\mathbf{A}_G^3\right)$  with constant probability, and leverage this to obtain improved randomized conditional lower bounds for various spectral sum estimation problems. We closely follow the trace estimation approach of [33], and again use the smaller spectral radius of  $\mathbf{A}_G$  to improve bounds on the power series truncation error.
4.2 Improved Lower Bounds for Effective Resistance Estimation
In this section we provide a series of reductions which yield our main result on lower bounds for the all pairs effective resistance estimation problem for all pairs of nodes (case where  $S = V \times V$ ).
Definition 10. In the SDD effective resistance estimation problem, given an SDD matrix  $\mathbf{M}$  such that  $\mathbf{D}_{\mathbf{M}} = \mathbf{I}$ ,  $\mathbf{A}_{\mathbf{M}} = \mathbf{Q}$ , with  $\rho(\mathbf{Q}) \leqslant 1/3$  and  $\epsilon \in (0,1)$ , we must output  $\tilde{r} \in \mathbb{R}^{n^2}$  such that  $\tilde{r}_{a,b} \approx_{\epsilon} \vec{\delta}_{a,b}^\top \mathbf{M}^{-1} \vec{\delta}_{a,b} \forall a, b \in [n]$ . We call  $\vec{\delta}_{a,b}^\top \mathbf{M}^{-1} \vec{\delta}_{a,b}$  the SDD effective resistance of  $(a,b)$  in  $\mathbf{M}$ .
For brevity, we use  $\widetilde{r} (\mathbf{M})$  to refer to the solution of the SDD effective resistance problem on input M. Our first step is to show that an algorithm for the all pairs effective resistance estimation problem on expanders implies an algorithm for the SDD effective resistance estimation problem.
Lemma 5. Given an algorithm to solve the all pairs effective resistance estimation problem on graphs with  $\widetilde{\Omega}(1)$ -expansion in  $\widetilde{O}(n^{2}\epsilon^{-c})$  time for some  $c > 0$ , we can produce an algorithm to solve the SDD effective resistance estimation problem in  $\widetilde{O}(n^{2}\epsilon^{-c})$  time.
To prove Lemma 5, we first prove the lemma for the case where  $\mathbf{Q}$  is entrywise non-negative by constructing an expander  $G$  with  $n + 1$  vertices such that  $r_{G}(a,b) = \vec{\delta}_{a,b}^{\top}\mathbf{M}^{-1}\vec{\delta}_{a,b}$  for all  $a,b\in [n]$ . We extend the reduction to arbitrary  $\mathbf{Q}$  by constructing  $\mathbf{Q}'$  of size  $2n$  so that  $\mathbf{Q}'$  is entrywise non-negative and  $\widetilde{r} (\mathbf{I} - \mathbf{Q})$  is a simple linear transform of  $\widetilde{r} (\mathbf{I} - \mathbf{Q}')$ .
We turn our attention to reducing the triangle detection problem to the SDD effective resistance problem. As discussed, a key aspect of our approach is to work with the random signing  $\bar{\mathbf{A}}_G$  of  $\mathbf{A}_G$ . Lemma 6 shows that to determine whether  $(\bar{\mathbf{A}}_G^2)_{i,j} > 0$  with constant probability, it suffices to determine whether  $(\bar{\mathbf{A}}_G^2)_{i,j} > 0$ . Matrix Chernoff ensures whp.  $\rho (\bar{\mathbf{A}}_G) = \tilde{O} (\sqrt{n})$ , while  $\rho (\mathbf{A}_G)$  could be as large as  $n$  [44]. So, estimating entries of  $\bar{\mathbf{A}}_G$  leads to lower power series tail error.
Lemma 6. For  $i \neq j$ , if  $(\mathbf{A}_G^2)_{i,j} = 0$ , then  $(\bar{\mathbf{A}}_G^2)_{i,j} = 0$ ; if  $(\mathbf{A}_G^2)_{i,j} > 0$ ,  $\mathbb{P}\left[|\langle \bar{\mathbf{A}}_G^2\rangle_{i,j}| > 1\right] \geqslant 1/2$ .
The idea of the proof is that if  $\{a,b\}, \{b,c\}$  exist in  $G$ , either  $\xi_{a,c} = 1$  or  $\xi_{a,c} = -1$  results in  $(\bar{\mathbf{A}}_G^2)_{a,c} > 0$ . Finally, we use the power series approach in Section 4.1 to obtain Theorem 9.
Theorem 9. Given an algorithm which solves the SDD effective resistance estimation problem in  $\widetilde{O}(n^{2}\epsilon^{-c})$  time, we can produce a randomized algorithm that solves the triangle detection problem in  $\widetilde{O}(n^{2(1 + c)})$  time whp.
Theorem 9 and Lemma 5 with  $c = 1/2 - \delta$  immediately imply our main result Theorem 4.
Additionally, we extend the lower bound of Theorem 4 to the all edges effective resistance estimation by the following reduction.
Lemma 7. Given an algorithm to solve the all edges effective resistance estimation problem (i.e., Definition 1 where  $S = E$ ) in  $\widetilde{O}(m\epsilon^{-c})$  time, we can produce an algorithm to solve the all pairs effective resistance estimation problem in  $\widetilde{O}(n^2\epsilon^{-c})$  time for some  $c > 0$ .
The rough idea behind the reduction is to add a complete graph of edges of sufficiently small weight that would not change the effective resistances much. Lemma 7 combined with Theorem 4 then imply a  $\widetilde{\Omega}(m\epsilon^{-1/2})$  randomized lower bound for the all edges effective resistance estimation problem on graphs with graphs with  $\widetilde{\Omega}(1)$ -expansion.
4.3 Improved Lower Bounds for Spectral Sum Estimation