Abstract 1 Introduction 2 Preliminaries 3 Main Algorithm 4 Lower Bound References Appendix A Useful Theorems

Quantum Speedup for Sampling Random Spanning Trees

Simon Apers Université Paris Cité, CNRS, IRIF, Paris, France Minbo Gao Key Laboratory of System Software (Chinese Academy of Sciences) and State Key Laboratory of Computer Science, Institute of Software, Chinese Academy of Sciences, Beijing, China
University of Chinese Academy of Sciences, Beijing, China
Zhengfeng Ji Department of Computer Science and Technology, Tsinghua University, Beijing, China Chenghua Liu Key Laboratory of System Software (Chinese Academy of Sciences) and State Key Laboratory of Computer Science, Institute of Software, Chinese Academy of Sciences, Beijing, China
University of Chinese Academy of Sciences, Beijing, China
Abstract

We present a quantum algorithm for sampling random spanning trees from a weighted graph in O~(mn) time, where n and m denote the number of vertices and edges, respectively. Our algorithm has sublinear runtime for dense graphs and achieves a quantum speedup over the best-known classical algorithm, which runs in O~(m) time. The approach carefully combines, on one hand, a classical method based on “large-step” random walks for reduced mixing time and, on the other hand, quantum algorithmic techniques, including quantum graph sparsification and a sampling-without-replacement variant of Hamoudi’s multiple-state preparation. We also establish a matching lower bound, proving the optimality of our algorithm up to polylogarithmic factors. These results highlight the potential of quantum computing in accelerating fundamental graph sampling problems.

Keywords and phrases:
Quantum Computing, Quantum Algorithms, Random Spanning Trees
Category:
Track A: Algorithms, Complexity and Games
Copyright and License:
[Uncaptioned image] © Simon Apers, Minbo Gao, Zhengfeng Ji, and Chenghua Liu; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Design and analysis of algorithms
; Theory of computation Quantum computation theory
Acknowledgements:
We would like to thank Yang P. Liu for explaining the details of their work. Minbo Gao and Chenghua Liu would like to thank Sebastian Zur for helpful discussions on quantum random walks and quantum sampling algorithms. Minbo Gao would like to thank Jingqin Yang for discussions of link-cut trees used in previous spanning tree sampling algorithms.
Funding:
The work is supported by National Key Research and Development Program of China (Grant No. 2023YFA1009403), National Natural Science Foundation of China (Grant No. 12347104), and Beijing Natural Science Foundation (Grant No. Z220002). SA was supported in part by the European QuantERA project QOPT (ERA-NET Cofund 2022-25), the French PEPR integrated projects EPiQ (ANR-22-PETQ-0007) and HQI (ANR-22-PNCQ-0002), and the French ANR project QUOPS (ANR-22-CE47-0003-01).
Editors:
Keren Censor-Hillel, Fabrizio Grandoni, Joël Ouaknine, and Gabriele Puppis

1 Introduction

Random spanning trees are among the oldest and most extensively studied probabilistic structures in graph theory, with their origins tracing back to Kirchhoff’s matrix-tree theorem from the 1840s [40]. This foundational result established a profound connection between spanning tree distributions and matrix determinants. Beyond graph theory, random spanning trees are deeply intertwined with probability theory [48] and exemplify strongly Rayleigh distributions [15]. Intriguingly, sampling random spanning trees has revealed unexpected and remarkable connections to various areas of theoretical computer science. Notably, they have been instrumental in breakthroughs that overcame long-standing approximation barriers for both the symmetric [31] and asymmetric versions of the Traveling Salesman Problem [12]. Goyal, Rademacher and Vempala [32] demonstrated their utility in constructing cut sparsifiers. Beyond their significance in theoretical computer science, random spanning trees also play a crucial role in machine learning and statistics. They have been applied to a wide range of tasks, including graph prediction [17], network activation detection [58], spatial clustering [60], online recommendation systems [37], and causal structure learning [26, 53].

Given its significant theoretical importance and broad applications, the problem of sampling random spanning trees has attracted substantial research interest, leading to a series of advancements in performance and algorithmic techniques [34, 16, 3, 44, 61, 19, 39, 49, 36, 27, 28, 57, 9]. These contributions can be broadly categorized into three main approaches:

  • Determinant calculation approaches [34, 44, 19]: These methods build on Kirchhoff’s matrix-tree theorem, which states that the total number of spanning trees in a weighted graph is equal to any cofactor of its graph Laplacian. Leveraging this theorem, one can calculate determinants to randomly select an integer between 1 and the total number of spanning trees and efficiently map this integer to a unique tree. This approach was first employed by Guenoche [34] and Kulkarni [44] to develop an O(mn3) time algorithm, where m and n denote the number of edges and vertices in the graph, respectively. Later, Colbourn, Myrvold, and Neufeld [19] improved it to an O(nω) time algorithm, where ω2.37 is the matrix multiplication exponent.

  • Approaches based on effective resistances [36, 27, 28]: The core insights behind there approaches is that the marginal probability of an edge being in a random spanning tree is exactly equal to the product of the weight and the effective resistance of the edge. Harvey and Xu [36] proposed a deterministic O(nω) time algorithm that uses conditional effective resistances to decide whether each edge belongs to the tree, iteratively contracting included edges and deleting excluded ones. Building on this, Durfee, Kyng, Peebles, Rao and Sachdeva [27] leveraged “Schur complements” to efficiently compute conditional effective resistances, resulting in a faster algorithm with a runtime of O~(n4/3m1/2+n2). In a separate work, Durfee, Peebles, Peng and Rao [28] introduced determinant-preserving sparsification, which enables the sampling of random spanning trees in O~(n2ϵ2) time, from a distribution with a total variation distance of ϵ from the true uniform distribution.

  • Random walk based approaches [16, 3, 61, 39, 49, 57, 9]: First introduced independently by Broder [16] and Aldous [3], it was shown that a random spanning tree can be sampled by performing a simple random walk on the graph until all nodes are visited, while retaining only the first incoming edge for each vertex. For unweighted graphs, this results in an O(mn) algorithm. The subsequent works [61, 39, 49] focused on accelerating these walks using various techniques involving fast Laplacian solving, electrical flows and Schur complements. This line of research culminated in Schild’s work [57], which achieved an almost-linear time algorithm with a runtime of m1+o(1). The current state-of-the-art algorithm employs a simple yet elegant approach based on “down-up random walks” with a near-optimal runtime O(mlog2m), and its mixing time analysis is technically intricate [56, 20, 9].

1.1 Main Result

In this work, we propose a quantum algorithm for approximately sampling random spanning trees, leading to the theorem below. We let 𝒲G denote the distribution over spanning trees of G, where each tree is sampled with probability proportional to the product of its edge weights.

Theorem 1 (Quantum algorithm for sampling a random spanning tree).

There exists a quantum algorithm 𝖰𝖱𝖲𝖳(𝒪G,ε) that, given query access 𝒪G to the adjacency list of a connected graph G=(V,E,w) (with |V|=n, |E|=m, w0E), and accuracy parameter ε, with high probability, outputs a spanning tree T of G drawn from a distribution which is ε-close to 𝒲G in total variation distance. The algorithm makes O~(mnlog(1/ε)) queries to 𝒪G, and runs in O~(mnlog(1/ε)) time.

We also prove a matching lower bound, showing that the runtime of our quantum algorithm is optimal up to polylog-factors.

Theorem 2 (Quantum lower bound for sampling a random spanning tree).

Let ε<1/2 be a constant. For any graph G=(V,E,w) with |V|=n, |E|=m, w0E, consider the problem of sampling a random spanning tree from a distribution ε-close to 𝒲G, given adjacency-list access to G. The quantum query complexity of this problem is Ω(mn).

1.2 Techniques

Our algorithm is based on the “down-up random walk” approach from [9]. Their core idea (already present in earlier work [55]) is to consider a random walk over spanning trees. In each step of the random walk, they randomly remove an edge to split it into two components, and then add a new edge sampled from the edges across the two components proportional to the edge weights. Their crucial contribution is to show that this random walk has a mixing time O~(n), which is sublinear with respect to the number of edges m. Since each step of the down-up random walk can be costly (O~(m), naively), their final algorithm actually considers an “up-down random walk”, where first an edge is added and then another edge is removed. While this walk has a larger mixing time O~(m), each step can now be implemented in amortized time O~(1) using link-cut trees.

1.2.1 Idea (and Barrier) for Quantum Speedups

To achieve a sublinear-time quantum algorithm, we could follow [9] and attempt to quantumly accelerate the mixing time of the up-down walk. However, apart from some special cases [2, 50, 52], no general quantum speedups for the mixing time of classical random walks are known. As a result, any algorithm with a mixing time of O~(m) does not yield a quantum advantage.

A natural alternative is to revisit the down-up random walk, which has a sublinear mixing time of O~(n), and leverage quantum techniques to speed up the implementation of each step. Specifically, after removing an edge, we can sample an edge between the two resulting components in O~(m) time using Grover search [33], compared to the classical O~(m) time. Unfortunately, this still results in an overall complexity of O~(mn)Ω~(m), offering no speedup over classical algorithms.

1.2.2 Our Approach

To overcome the above barriers, we use an amortization idea of implementing a “large-step” down-up walk instead of a single-step approach. In a standard down-up walk, a single edge in the spanning tree is changed after each step. In contrast, the large-step down-up walk modifies several edges – approximately Θ(n) – in each step, resulting in a significantly faster mixing time of O~(1). These Θ(n) edges are sampled from a batch of O~(n) edges, which we select among the m edges in time O~(mn) using quantum search. While the framework appears simple at first glance, implementing each step requires a careful integration of various quantum algorithms. Additionally, analyzing the mixing time relies on deep results from [10]. Below, we outline the main techniques utilized in our approach:

Domain Sparsification Under Isotropy

Domain sparsification [6, 7, 10] is a framework which aims to reduce the task of sampling from a distribution on ([m]k) with km to sampling from some related distribution on ([t]k) for tm. For so-called “strongly Rayleigh distributions” [15], the domain size can be reduced to be nearly linear in the input size with t=O~(k) [10]. For random spanning trees, which are a canonical example of a strongly Rayleigh distribution, this reduces the sampling problem from domain ([m]n) to ([t]n) with tO~(n). This provides an opportunity for quantum acceleration, provided that it is easier to sample this subdomain of O~(n) edges.

A key technique enabling efficient sampling of such a subdomain is the “isotropic transformation”, which can be interpreted as a discrete analogue of the isotropic position of a continuous distribution [54, 45]. Originally developed in the context of designing algorithms for sampling from logconcave distributions, the isotropic position uses a linear map to convert a distribution into a standard form, enabling faster and more efficient sampling. In [10], Anari Liu and Vuong describe a discrete isotropic transformation for distributions over ([m]k) based on the marginals of individual elements of [m]. After this isotropic transformation, domain sparsification reduces to sampling a subdomain uniformly at random from the domain.

For the particular case of sampling random spanning trees, the marginal probability of an edge is given by its effective resistance, and domain sparsification amounts to sampling edges uniformly at random in the isotropic-transformed multigraph (see Lemma 18), whose construction is based on the effective resistances of the edges in the original graph.

In our algorithm, rather than explicitly computing this isotropic transformation (whose description size is O~(m) which we cannot tolerate), we utilize a quantum data structure, 𝖰𝖱𝖾𝗌𝗂𝗌𝗍𝖺𝗇𝖼𝖾, which provides quantum query access to effective resistances, to “implicitly” construct and maintain the isotropic-transformed multigraph. More specifically, with 𝖰𝖱𝖾𝗌𝗂𝗌𝗍𝖺𝗇𝖼𝖾 in place, we can efficiently implement the up step of the walk, which involves sampling a subdomain of O(n) edges uniformly from the implicit isotropic-transformed multigraph, as well as the down step, which requires sampling a random spanning tree from the resulting O~(n)-edge subdomain.

Quantum Graph Algorithms and Quantum Multi-Sampling

To achieve the near-optimal quantum speedup, our algorithm incorporates a suite of quantum algorithms as subroutines. During the initialization stage, it utilizes the quantum minimum spanning tree algorithm proposed in [29] to identify a starting spanning tree, reducing the complexity from O~(m) to O~(mn). For approximating the effective resistance, we adopt the approach in [11] that combines the quantum graph sparsification algorithm with the Spielman-Srivastava toolbox [59] to construct an efficient 𝖰𝖱𝖾𝗌𝗂𝗌𝗍𝖺𝗇𝖼𝖾 data structure in O~(mn) time. This data structure provides query access to approximate effective resistances with a cost of O~(1) per query. For the up operation, we develop a variant of quantum search, 𝖰𝖨𝗌𝗈𝗍𝗋𝗈𝗉𝗂𝖼𝖲𝖺𝗆𝗉𝗅𝖾, for sampling multiple edges in the isotropic-transformed graph with up to a quadratic speedup. The key idea behind this algorithm is to leverage a variant of the “preparing many copies of quantum states” technique proposed in [35], utilizing the query access provided by our 𝖰𝖱𝖾𝗌𝗂𝗌𝗍𝖺𝗇𝖼𝖾. This variant of the Hamoudi’s technique can be thought of as a sampling without replacement method, ensuring that the samples are all different. Notably, 𝖰𝖨𝗌𝗈𝗍𝗋𝗈𝗉𝗂𝖼𝖲𝖺𝗆𝗉𝗅𝖾 efficiently samples a set of O~(n) edges in O~(mn) time. Leveraging these algorithms, our approach ultimately achieves random spanning tree sampling in O~(mn) time.

1.2.3 Lower Bound

The lower bound follows from a reduction of the problem of finding n marked elements among m elements, whose quantum query complexity is Θ(mn), to the problem of sampling a uniform spanning tree in a weighted graph. The reduction encodes the search problem into the weights of a fixed graph, in such a way that a uniformly random spanning tree in that graph reveals the marked elements. The argument is similar to the Ω(mn) lower bound from [29] on the quantum query complexity of finding a minimum spanning tree.

1.3 Open Questions

Our work raises several interesting questions and future directions, including the following:

  • The runtime of our quantum algorithm is tight, up to polylogarithmic factors, for sampling random spanning trees in weighted graphs. Can we potentially improve the runtime for unweighted graphs, for instance, to O~(n)? This is the case for constructing spanning trees, as was shown in the earlier work [29]. Note that our Ω(mn) lower bound applies only to the weighted graph case. We were unable to prove a ω(n) lower bound for the unweighted case, based on which we conjecture that there exist more efficient algorithms for the unweighted case.

  • This work represents the first application of the down-up walk in quantum algorithm design. As demonstrated by a series of breakthroughs in sampling and counting problems for spin systems [4, 8, 18, 38, 5, 47, 13, 1], the down-up walk has proven highly effective in designing classical algorithms for a variety of graph problems. Notable examples include independent set sampling [4, 8], q-colorings sampling [18, 38, 13], edge-list-colorings sampling [1], planar matching counting and sampling [5], and vertex-list-colorings sampling [47]. Given these successes, it would be intriguing to explore whether quantum speedups can be achieved for these problems.

  • Additionally, exploring quantum speedups for determinantal point processes (DPPs) is a natural and meaningful direction. Like random spanning trees, DPPs are strongly Rayleigh distributions, enabling efficient domain sparsification [6, 7, 10]. They also play a crucial role in applications such as machine learning [42, 43, 23], optimization [21, 23, 51], and randomized linear algebra [24, 22, 25]. Developing quantum algorithms for DPPs could lead to quantum computational advantages in these areas.

2 Preliminaries

For simplicity, we use [n] to represent the set {1,2,,n} and [n]0 to represent the set {0,1,,n1}. We consider an undirected weighted graph G=(V,E,w), where V is the vertex set, E is the edge set, and w:E0 represents the weight function. We use n,m to denote the size of V and E, respectively. We use δi to denote the vector whose elements are 0 except for the i-th element, which is 1.

For a distribution defined over all subsets μ:2[m]0 and S[m], let μS be the restricted distribution of Pμ conditioned on the event PS.

2.1 Quantum Computational Model

We assume the same quantum computational model as in for instance [29, 11]. This entails a classical control system that (i) can run quantum circuits on O(logn) qubits, (ii) can make quantum queries to the adjacency list oracle 𝒪G, and (iii) has access to a quantum-read/classical-write RAM of O~(mn) bits. The quantum query complexity measures the number of quantum queries that an algorithm makes. The quantum time complexity measures the number of elementary operations (classical and quantum gates), quantum queries, and single-bit QRAM operations (classical-write or quantum-read). If we only care about the quantum query complexity, then we can drop the QRAM assumption at the expense of a polynomial increase in the time complexity.

2.2 Markov Chains and Mixing time

Let μ,ν be two discrete probability distributions over a finite set Ω. The total variation distance (or TV-distance) between μ and ν is defined as

μνTV:=12xΩ|μ(x)ν(x)|.

The Kullback-Leibler (KL) divergence, also known as relative entropy, between μ and ν is defined as

𝒟KL(μν):=xΩμ(x)log(μ(x)ν(x)).

A well-known result, often summarized as “relative entropy never increases”, is stated in the following theorem:

Theorem 3 (Data Processing Inequality).

For any transition probability matrix PΩ×Ω and pair of distributions μ,ν:Ω0, it holds that

𝒟KL(νPμP)𝒟KL(νμ).

A Markov chain on a finite state space Ω is specified by its transition probability matrix PΩ×Ω. For a comprehensive introduction to the analysis of Markov chains, we refer the reader to [46]. A distribution μ is said to be stationary with respect to P if μP=μ. In this case, μ is also called the stationary distribution of the Markov chain. When P is ergodic, the Markov chain has a unique stationary distribution μ, and for any initial probability distribution ν on Ω, νPtμTV converges to 0 as t. To precisely characterize how quickly an ergodic Markov chain converges, one can define the mixing time as below.

Definition 4 (Mixing time).

Let P be an ergodic Markov chain on a finite state space Ω and let μ denote its stationary distribution. For any probability distribution ν on Ω and ε(0,1), we define

tmix(P,ν,ε):=min{t0νPtμTVε}.

The following well-known theorem demonstrates the relationship between the modified log-Sobolev constant and mixing times, which bounds the mixing time via modified log-Sobolev inequalities.

Theorem 5 ([14], see also corollary 8 in [20]).

Let P denote the transition matrix of an ergodic, reversible Markov chain on a finite state space Ω with the stationary distribution μ. Suppose there exists some α(0,1] such that for any probability distribution ν on Ω, we have

𝒟KL(νPμP)(1α)𝒟KL(νμ).

Then, for any ε(0,1),

tmix(P,1x,ε)1α(loglog(1μ(x))+log(12ε2)),

where 1x is the point mass distribution supported on x.

2.3 Laplacian and Graph Sparsification

For an undirected weighted graph G=(V,E,w), the weighted degree of a vertex v is defined as deg(v)=eE:vewe, where the sum is taken over all edges e incident to v, and we denotes the weight of edge e.

Definition 6 (Laplacian).

The Laplacian of a weighted graph G=(V,E,w) is defined as the matrix LGV×V such that

(LG)ij={deg(i)if i=j,wijif {i,j}E,0otherwise.

Equivalently, the Laplacian of graph G is given by LG=DGAG, with AG the weighted adjacency matrix (AG)ij=wij and D the diagonal weighted degree matrix DG=diag(deg(i):iV). LG is a positive semidefinite matrix since the weight function w is nonnegative, and LG induces the quadratic form

xLGx={i,j}Ewij(xixj)2

for arbitrary vector xV. Graph sparsification produces a reweighted graph with fewer edges, known as a graph spectral sparsifier. A graph spectral sparsifier of G is a re-weighted subgraph that closely approximates the quadratic form of the Laplacian for any vector xV.

In the groundbreaking work [59], the authors demonstrated that graphs can be efficiently sparsified by sampling O~(n) edges with weights roughly proportional to their effective resistance. Now, we introduce the concept of effective resistance.

Definition 7 (Effective Resistance).

Given a graph G=(V,E,w), the effective resistance Rij of a pair of i,jV is defined as

Rij=(δiδj)LG+(δiδj)=(LG+)1/2(δiδj)2.

Here, δi is a vector with all elements equal to 0 except for the i-th is 1, and LG+ is the Moore-Penrose inverse of the Laplacian matrix LG.

Definition 8 (Leverage Score and Leverage Score Overestimates).

Given a graph G=(V,E,w), the leverage score e of an edge eE is defined as the product of its weight and its effective resistance:

e=weRij,for e={i,j}.

An λ-leverage score overestimates ~ for G is a vector in 0E satisfying ~1λ, and ~ee=weRe for all eE.

Lemma 9 (Foster’s theorem [30]).

For a weighted graph G=(V,E,w), let e denote the leverage score of an edge eE. Then, it holds that eEen1.

Proof.

For a edge {i,j}, recall that Rij=(δiδj)LG+(δiδj), then

eEe={i,j}EwijRij={i,j}ETr(wij(δiδj)(δiδj)LG+)=Tr(LGLG+)n1,

since the rank of LG is at most n1.

2.4 Strongly Rayleigh Distributions and Random Spanning Tree

Before defining strongly Rayleigh distributions, we first introduce the stability of generating polynomials, a fundamental property in both mathematics and physics. For a probability distribution μ:([m]k)0, we define the generating polynomial fμ of μ as

fμ(z1,,zm)=S([m]k)μ(S)iSzi.

A nonzero polynomial f[z1,,zm] is called stable if, i[m], the fact that Im(zi)>0 implies that f(z1,,zm)0. A stable polynomial with real coefficients is called real stable.

We say μ is a strongly Rayleigh distribution if and only if fμ is a real stable polynomial. We say μ is k-homogeneous if fμ is k-homogeneous. A useful fact is that if μ is strongly Rayleigh, then its restricted distribution μS for arbitrary S[m] is also strongly Rayleigh. For more details, we refer the reader to [15].

For any connected undirected weighted graph G=(V,E,w), let 𝒯G([m]n1) denote the set of all spanning trees of G. We provide the formal definition of random spanning tree below.

Definition 10 (w-uniform distribution on trees).

For any connected weighted undirected graph G=(V,E,w), the distribution 𝒲G on 𝒯G is w-uniform if X𝒲G[X=T]eTwe.

We refer to 𝒲G as the w-uniform distribution on 𝒯G. A random spanning tree drawn from the distribution 𝒲G is called w-uniform.

Proposition 11 (Spanning Tree Marginals).

Given a graph G=(V,E,w), the probability that an edge e={i,j}E appears in a tree sampled w-uniformly randomly from 𝒯G is given by its leverage score e=weRij. Namely, T𝒲G[eT]=e.

Proposition 12 (Spanning Trees are Strongly Rayleigh [15, Theorem 3.6]).

For any connected weighted undirected graph G=(V,E,w), the w-uniform distribution 𝒲G is (n1)-homogenous strongly Rayleigh.

Theorem 13 (Random Tree Sampling [9, Theorem 2]).

There is an algorithm 𝖱𝖲𝖳(G,ε) that, given a connected weighted graph G=(V,E,w) and ε>0, outputs a random spanning tree in O(mlogmlog(m/ε)) time. The distribution of output is guaranteed to be ε-close to 𝒲G in total variation distance.

2.5 Down-up and Up-down Walks

For a distribution μ on ([m]k), we define the complement distribution μ¯ on ([m]mk) by setting μ¯(S)=defμ([m]S) for every S([m]mk).

Definition 14 (Down operator).

For k define the row-stochastic matrix Dk0([m]k)×([m]) by

Dk(S,T)={0 if TS,1(k) otherwise. 

For a distribution μ on sets of size of k, μDk will be a distribution on sets of size of . In particular, μDk1 will be the marginal distribution of μ: Sμ(iS)/k, i[m].

Definition 15 (Up operator).

For k define the row-stochastic matrix Uk0([m])×([m]k) by

Uk(T,S)={0 if TS,μ(S)S:TSμ(S) otherwise. 

We consider the following Markov chain Mμt defined for any positive integer tk+1, with the state space supp(μ). Starting from S0supp(μ), one step of the chain Mμt is:

  1. 1.

    Sample T([m]S0tk) uniformly randomly.

  2. 2.

    Sample S1μS0T and update S0 to be S1.

In [7, 10], it was demonstrated that the above constructed Markov chain can be used for sampling, as it possesses several desirable properties.

Proposition 16 (Proposition 25 in [7], see also Proposition 15 and 16 in [10]).

The complement of S1 is distributed according to μ¯0D(mk)(mt)U(mt)(mk) if we start with S0μ0. Moreover, for any distribution μ:([m]k)0 that is strongly Rayleigh, the chain Mμt for tk+1 is irreducible, aperiodic and has stationary distribution μ.

3 Main Algorithm

Our main quantum algorithm implements a “large-step” up-down walk over the spanning trees of G. Starting from a spanning tree T, the up-step samples k=2n edges S uniformly at random from ET, and then the down-step samples a uniform spanning tree from the subgraph on TS. We can show that, if the graph is nearly-isotropic, meaning that its edges have approximately uniform leverage scores, this walk achieves a mixing time of O~(1) (see Proposition 20).

In practice, most input graphs are not naturally isotropic. Isotropy here refers to a balanced structure where every edge contributes roughly equally to the connectivity of the graph. This balanced contribution is captured by the concept of leverage scores, which, in our setting, are given by the product of the effective resistances of the edges and their corresponding weights. The effective resistance of an edge serves as a measure of its “importance” in maintaining connectivity: edges with high effective resistance (or high leverage scores) have an outsized influence on the spanning tree distribution. If these values vary significantly across edges, the uniform sampling in the up-step may become biased, adversely affecting the mixing time of the chain. To address this, we introduce a preprocessing step that “isotropizes” G by approximately normalizing the effective resistances. Specifically, we construct a quantum data structure 𝖰𝖱𝖾𝗌𝗂𝗌𝗍𝖺𝗇𝖼𝖾 that enables efficient quantum queries to constant-factor approximations of the effective resistances of the edges in G. This builds upon the quantum graph sparsification algorithm from [11], which efficiently estimates effective resistances. This preprocessing step, which we detail in Proposition 25, takes O~(mn) time. Once initialized, it allows us to simulate quantum query access to an isotropic-transformed version of G, denoted as G. With quantum query access to G, we can then implement the up-step efficiently by uniformly sampling k edges, thereby preserving the desired rapid mixing properties of the Markov chain.

As initial state of the random walk, the algorithm obtains a maximum weight-product spanning tree T by running the quantum algorithm 𝖰𝖬𝖺𝗑𝖯𝗋𝗈𝖽𝗎𝖼𝗍𝖳𝗋𝖾𝖾, a slightly modified version of the algorithm from [29] (see Theorem 27 for details). We label the tree with all its edges having 1 as a label, i.e., e(e,1) (the label is used for identification in the isotropic-transformed graph) and store it in QRAM. Subsequently, the algorithm executes O~(1) rounds of the up-down walk. To implement the up-step, we develop a quantum algorithm 𝖰𝖨𝗌𝗈𝗍𝗋𝗈𝗉𝗂𝖼𝖲𝖺𝗆𝗉𝗅𝖾 for uniformly sampling k edges S in the isotropic-transformed graph. The key idea is to combine a routine for “preparing many copies of quantum states” with the leverage score oracle access given by our 𝖰𝖱𝖾𝗌𝗂𝗌𝗍𝖺𝗇𝖼𝖾 algorithm. We detail this algorithm in Theorem 24. Notably, the algorithm 𝖰𝖨𝗌𝗈𝗍𝗋𝗈𝗉𝗂𝖼𝖲𝖺𝗆𝗉𝗅𝖾 returns a sparsified domain of k=2n edges in O~(mn) time.

Using oracles to G and , we then build the subgraph with edges TS using the 𝖲𝗎𝖻𝗀𝗋𝖺𝗉𝗁𝖢𝗈𝗇𝗌𝗍𝗋𝗎𝖼𝗍 procedure. This subgraph has O(n) edges, and so we can apply the classical spanning tree sampling algorithm 𝖱𝖲𝖳 (Theorem 13) to obtain a random spanning tree in the subgraph in O~(n) time. This effectively implements the down-operator.

We present our algorithm in Algorithm 1.

Algorithm 1 Quantum Algorithm for Random Spanning Tree Sampling, 𝖰𝖱𝖲𝖳(𝒪G,ε).

More details of the subroutines employed in the algorithm are given below:

  • The procedure 𝖫𝖺𝖻𝖾𝗅(T0) means that we add a specific label 1 to all the edges of T0.

  • The procedure 𝖰𝖲𝗍𝗈𝗋𝖾𝖳𝗋𝖾𝖾(T) stores the tree T into a QRAM allowing for coherent quantum queries, given its classical description as the input.

  • The procedure 𝖲𝗎𝖻𝗀𝗋𝖺𝗉𝗁𝖢𝗈𝗇𝗌𝗍𝗋𝗎𝖼𝗍(𝒪G,,Tt1,St) constructs the subgraph after the up-step. More precisely, given query access 𝒪G to G=(V,E,w), query access to approximate resistance R~, a classical description of a tree Tt1 in G, and a set St of labeled edges, we define the multigraph G=(V,E,w), where E={(e,j)eE,j[qe]} with qe=mweR~en and w(e,j)=we/qe. We treat Tt1 and St as subsets of edges in G. The procedure 𝖲𝗎𝖻𝗀𝗋𝖺𝗉𝗁𝖢𝗈𝗇𝗌𝗍𝗋𝗎𝖼𝗍 just outputs a classical description of the graph Ht=(V,Et,wt), where Et=Tt1St, and wt(f)=w(f) for fEt1.

3.1 Isotropic Transformation

Inspired by [6, 7, 10], we consider a process that transforms a graph into a multigraph, ensuring that the resulting random spanning tree distribution is nearly-isotropic.

Definition 17 (Isotropic Transformation of a Graph).

Consider a connected weighted graph G=(V,E,w), with λ-leverage score overestimates ~0E for G. The isotropic transformed multigraph G of G (with respect to ~) is defined as G=(V,E,w): Here E={(e,j)eE,j[qe]}, where (e,j) connects the same vertices as e, and qe=m~eλ; w(e,j)=we/qe for all eE and j[qe].

Lemma 18 (Isotropic Bound).

For a graph G=(V,E,w) with |V|=n and |E|=m, let ~0E be its λ-leverage score overestimates. Let G=(V,E,w) denotes the isotropic-transformed graph of G with respect to ~. Then, it holds that |E|2|E|. Furthermore, for all (e,j)E, we have

S𝒲G[(e,j)S]λm.
Proof.

One has

|E|=eEqeeE(1+m~eλ)m+m~1λ2m.

For any e={a,b}E and j[qe], the marginal

S𝒲G[(e,j)S]=w(e,j)Rab=w(e,j)Rab=weRabqeλm,

where the first equality follows from Proposition 11, and the second equality follows from the fact that Rab=Rab.

The following theorem demonstrates that the down operator satisfies a significantly stronger entropy contraction inequality when applied to strongly Rayleigh distributions with nearly uniform marginals.

Theorem 19 ([10, Theorem 28]).

Let μ:([m]k)0 be a strongly Rayleigh distribution with marginals pm defined by pi=defSμ[iS]. Suppose μ satisfies

pmax=defmax{pi:i[m]}1/500.

Then for any distribution ν¯:([m]mk)0 and tk+1, we have

𝒟KL(ν¯D(mk)(mt)μ¯D(mk)(mt))(1κ)𝒟KL(ν¯μ¯)

with κ=Θ(tk(mpmax+t)log2m).

Proposition 20.

Let G=(V,E,w) be a weighted graph with |V|=n, |E|=m, and w0E. Suppose G has λ-leverage score overestimates given by ~0E, and assume m1000n and λ2n. Consider the isotropic transformed multigraph G=(V,E,w) of G with respect to ~, as defined in Definition 17. Let tn be an integer, m=|E|, and define the transition matrix P=D(mn+1)(mt)U(mt)(mn+1). Then, the mixing time satisfies

tmix(P,Tmax,ε)=O(log3(n)log(1/ε)). (1)

Here, Tmax={(e,1)eTmax}E, where Tmax is the maximum weight-product spanning tree of G.

Proof.

For the isotropic-transformed graph G, by Lemma 18, we have m2m, and

S𝒲G[(e,j)S]λm2nm1500.

Let 𝒯G denote the set of all spanning trees of G, and let μ:([m]n1)0 be the w-uniform distribution on 𝒯G. Applying Theorem 19 with t=2n and k=n1, we obtain that, for any distribution ν¯:([m]mk)0,

𝒟KL(ν¯D(mn+1)(mt)μ¯D(mn+1)(mt))(1κ)𝒟KL(ν¯μ¯),

where κ1=O(log2m)=O(log2n). Thus, by the data processing inequality (Theorem 3), we have

𝒟KL(ν¯Pμ¯P)(1κ)𝒟KL(ν¯μ¯).

Combining the above result with the modified log-Sobolev inequality (Theorem 5), we conclude that

tmix(P,Tmax,ε)1κ(loglog(1μ(Tmax))+log(12ε2)) (2)

Now, observe that by the pigeonhole principle we have μ(Tmax)1/(mn1)=Ω(1/mn). Consequently, μ(Tmax)μ(Tmax)/(m)n1=Ω(1/(2m)n). Thus, the claim follows as desired.

As a side remark, we note that by applying Proposition 16, we can prove a bound of the mixing time for the complement (up-down walk) in a similar way.

3.2 QIsotropicSample Routine

In this subsection, we provide further details about the 𝖰𝖨𝗌𝗈𝗍𝗋𝗈𝗉𝗂𝖼𝖲𝖺𝗆𝗉𝗅𝖾 routine, which is designed for implementing the up-step. The goal of 𝖰𝖨𝗌𝗈𝗍𝗋𝗈𝗉𝗂𝖼𝖲𝖺𝗆𝗉𝗅𝖾 is to sample a set of k distinct edges from the isotropic-transformed multigraph uniformly at random. Throughout the discussion, we refer to this type of task as uniformly random k-subset sampling (of a set [m]), which means sampling a uniformly random k-size subset of the set [m].

A crucial distinction between uniformly sampling a k-size subset of the set [m] and uniformly and independently sampling k times from [m] lies in the sampling method. The former requires sampling without replacement, while the latter involves sampling with replacement. Notably, the latter can be addressed directly using the “preparing many copies of a quantum state” algorithm (see Theorem 26 for more details). Building on this, we propose a reduction from sampling with replacement to sampling without replacement in the following, leading to an efficient quantum implementation for uniformly random k-subset sampling (Theorem 23) and the 𝖰𝖨𝗌𝗈𝗍𝗋𝗈𝗉𝗂𝖼𝖲𝖺𝗆𝗉𝗅𝖾 routine (Theorem 24).

We begin with the following combinatorial proposition, which shows that we can first perform the sampling with replacement, and then discard any repeated elements to accomplish uniformly random k-subset sampling.

Proposition 21.

Let m. Suppose j1,j2,,jk[m] are integers which are uniformly and independently sampled from [m]. Then, conditioning on the distinctness of these integers, the distribution of {j1,j2,,jk} is the same as the distribution of a uniformly random k-subset of [m].

Proof.

Consider any fixed set S={s1,s2,,sk}. For the uniformly random k-subset sampling, the probability that S occurs is exactly 1(mk).

For j1,,jk which are uniformly and independently sampled from [m], the probability that they form a permutation of {s1,,sk} is k!/mk. The probability that they are pairwise distinct is m!/(mk(mk)!). Therefore, conditioning on the pairwise distinctness, the probability that {j1,j2,,jk}=S is just

k!/mkm!/((mk)!mk)=1(mk).

We then consider how many samples are sufficient for k distinct results, which is formalized in the following modified balls-into-bins lemma.

Lemma 22.

Let X be a uniformly random variable taking values in [m]. For k[m], let R be the set of different results from sampling X for Θ~(k) times. Then, with high probability, we have |R|k.

Proof.

Let Yi denote the number of samples needed for |R|=i1 to become |R|=i. Let Y=i=1kYi. When |R|=i1, the probability that a sample falls in [m]R is pi=(mi+1)/m. By definition, Yi obeys the geometric distribution, meaning that

Pr[Yi=k]=(1pi)k1pi.

Therefore, 𝐄[Yi]=1/pi=m/(mi+1). By the linearity of expectations, we have

𝐄[Y]=i=1k𝐄[Yi]=i=1km(mi+1)i=1kk(ki+1)klog(k).

Thus, by Markov’s inequality, with probability at least 2/3, Y3klog(k), and the claim follows by amplifying the successful probability using Hoeffding’s inequality.

By combining the above propositions and Theorem 26, we obtain a quantum algorithm for uniformly random k-subset sampling from a set, which is described in the following corollary.

Theorem 23 (Quantum uniform random k-subset sampling).

There exists a quantum algorithm 𝖬𝗎𝗅𝗍𝗂𝖲𝖺𝗆𝗉𝗅𝖾(𝒪w,k) that, given query access Ow to a vector wn (where w1=O(poly(n))), and k[n], with high probability, returns a uniformly random k-size subset S of Sw={(j,)|j[n],[wj]}. The algorithm uses O~(nk) queries to 𝒪w and runs in O~(nk) time.

Proof.

In the following, we denote k=cklogk where c is a sufficiently large constant.

From Theorem 26, we know with high probability, the algorithm 𝖬𝗎𝗅𝗍𝗂𝖯𝗋𝖾𝗉𝖺𝗋𝖾(𝒪w,k) will return k copies of the state

|w=1Wj=1nwj|j,

where W=j=1nwj, using O~(nk) queries to 𝒪w and in O~(nk) time. We then measure the k states on the computational basis, obtaining k samples j1,j2,jk.

Then, for each sample ji, we query the oracle 𝒪w with the state |ji|0, and measure the state 𝒪w|ji|0 in the computational basis to get the value of wji. We then uniformly sample a integer i[wji], producing a uniformly random sample (ji,i) from Sw. For each sample ji, these operations take O~(1) time. After the above procedure, we get a sequence (j1,1),(j2,2),,(jk,k).

We then output the first k distinct elements of the above sequence (if there are no such k elements, the algorithm simply outputs fail; by Lemma 22, the probability of this situation occurring is small.). By Proposition 21, these elements constitute a set of size k which is uniformly randomly drawn from Sw. It is clear that the above algorithm uses O~(nk) queries to 𝒪w in total and runs in O~(nk) time.

As a direct result of Theorem 23, given adjacency list access to a graph and query access to its approximate resistance, we can sample k different edges in the isotropic-transformed graph in O~(mk) time, yielding an efficient quantum implementation of the up-step.

Theorem 24 (Quantum Multi-Sampling in the Isotropic-Transformed Graph).

There exists a quantum algorithm 𝖰𝖨𝗌𝗈𝗍𝗋𝗈𝗉𝗂𝖼𝖲𝖺𝗆𝗉𝗅𝖾(𝒪G,𝒯,,k), that, given query access 𝒪G to a graph G=(V,E,W) (where |V|=n and |E|=m), access 𝒯 to a labeled tree T of the multigraph G=(V,E,w), access to an instance of 𝖰𝖱𝖾𝗌𝗂𝗌𝗍𝖺𝗇𝖼𝖾 that allows quantum query to the approximate effective resistance R~e for edge e, and integer km, with high probability, outputs a uniformly random k-size subset S of ET, where E={(e,j)eE,j[qe]}, with qe=mweR~en. The algorithm uses O~(mk) queries to 𝒪G and , and runs in O~(mk) time.

Proof.

By definition, we have

𝒪G|e|0=|e|we, and |e|0=|e|R~e.

Thus, together with access 𝒯 to a labeled tree T, we could implement a unitary Uq satisfying

Uq|e|0=|e|qe

with qe=mweR~en if eEET, and qe=0 if eET, using O~(1) queries and in O~(1) time. This is because we can coherently evaluate qe given 𝒪G, and 𝒯.

Then, using Theorem 23, with high probability, the algorithm 𝖬𝗎𝗅𝗍𝗂𝖲𝖺𝗆𝗉𝗅𝖾(Uq,k) will return a set S of size k which is uniformly drawn from E={(e,j)eE,j[qe]}, using O~(mk) queries to 𝒪G, and in O~(mk) time.

3.3 Proof of Main Theorem

We can now prove our main theorem.

Proof.

Without loss of generality, we assume n/m=o(1). At the initial step, the algorithm executes the subroutine 𝖰𝖱𝖾𝗌𝗂𝗌𝗍𝖺𝗇𝖼𝖾 to obtain query access to 110-overestimates effective resistances of G in O~(mn) time (by Proposition 25). It then applies 𝖰𝖬𝖺𝗑𝖯𝗋𝗈𝖽𝗎𝖼𝗍𝖳𝗋𝖾𝖾 (see Theorem 27) to find a spanning tree T0 as the start in O~(mn) time. Each edge eT0 is then assigned a label e(1), and the labeled tree is stored in O~(n) time in the procedure 𝖫𝖺𝖻𝖾𝗅 and 𝖰𝖲𝗍𝗈𝗋𝖾𝖳𝗋𝖾𝖾.

Subsequently, in each iteration t[M], the algorithm first uses the sampling subroutine 𝖰𝖨𝗌𝗈𝗍𝗋𝗈𝗉𝗂𝖼𝖲𝖺𝗆𝗉𝗅𝖾 to sample a uniformly random set St of size k from ETt1 in O~(mk) time, where k=Θ(n). Next, using Theorem 13, it samples a labeled random spanning tree in the subgraph Ht in O~(n) time, since the edge-set of subgraph Tt1St has size at most n1+k=O(n). Overall, the algorithm’s time complexity is O~(mn). It remains to prove the correctness of algorithm.

We first observe that R~e is a 110-overestimate of Re, i.e., ReR~e1110Re for all eE. Thus, ~e=weR~e provides an 1110n-leverage score overestimates, as shown below:

eEweR~eeE1110weRe1110n,

where the final inequality follows from Foster’s theorem (Lemma 9).

If the sampling error for the random spanning tree in each iteration (line 8 of Algorithm 1) is zero, then each iteration can be viewed as one step of the chain Mμk, where μ:([m]k)0 corresponds exactly to the random spanning tree distribution 𝒲G. Here, m represents the number of edges of the isotropic multigraph G satisfying m2m. By Proposition 20, the (ideal) up-down walk has mixing time O(log3(n)log(1/ε)) (Equation 1). We can hence pick MO(log3(n)log(1/ε)) so as to ensure that the (ideal) up-down walk returns a tree TM that is distributed ε/2-close to 𝒲G. Since G is obtained by equally dividing the weight of each edge in G among the multiedges, mapping the multigraph G back to G ensures that distribution of the unlabeled tree TM remains ε/2-close to 𝒲G.

Taking into account the sampling error, note that we chose the error of 𝖱𝖲𝖳(Ht,ε/(2M)) to be ε/(2M), ensuring that in each iteration, the TV-distance between the actual and ideal case is at most ε/(2M). After M iterations, the cumulative TV-distance is bounded by ε/2. Since the ideal case returns TM that is ε2-close to 𝒲G, actual distribution of TM will be ε-close to 𝒲G.

4 Lower Bound

Here we prove our lower bound, showing that the algorithm’s time and query complexity are optimal, up to polylogarithmic factors.

See 2

Proof.

The argument is similar to the Ω(mn) lower bound from [29] on the quantum query complexity of finding a minimum spanning tree, and follows from a lower bound on quantum search. Let m=k(n+1) for some integer k. Consider a binary matrix M{0,1}n×k, with the promise that every row of M contains a single 1-entry. The task of finding all n 1-entries corresponds to solving n parallel ORk instances. By the direct product theorem on the quantum query complexity of the ORk-function [41], the quantum query complexity of this problem is Θ(nk)=Θ(mn).

Now we construct a weighted graph GM from M, in such a way that solving the aforementioned search problem on M reduces to sampling a random spanning tree from GM. The vertices of GM are {s,1,,k,r1,,rn}. Its edges are all (s,i) with edge weight 1, and all (i,rj) with edge weight Mij. Notably, there are n+k+1 vertices and n+k weight-1 edges. The union of these edges forms the unique spanning tree T with nonzero weight ΠeTwe=1. As a consequence, sampling a random spanning tree in GM always returns T. Since T identifies all weight-1 edges in GM (and hence all 1-entries in M), the quantum query complexity is Ω(mn)111A more refined argument shows that the lower bound even holds when all the edge weights are nonzero. The argument works by replacing wij{0,1} by wij{1/n4,1}, and noting that a random spanning tree still returns T with constant probability..

References

  • [1] Dorna Abdolazimi, Kuikui Liu, and Shayan Oveis Gharan. A matrix trickle-down theorem on simplicial complexes and applications to sampling colorings. In 2021 IEEE 62nd Annual Symposium on Foundations of Computer Science (FOCS), pages 161–172. IEEE, 2022.
  • [2] Dorit Aharonov, Andris Ambainis, Julia Kempe, and Umesh Vazirani. Quantum walks on graphs. In Proceedings of the thirty-third annual ACM symposium on Theory of computing, pages 50–59, 2001. doi:10.1145/380752.380758.
  • [3] David J Aldous. The random walk construction of uniform spanning trees and uniform labelled trees. SIAM Journal on Discrete Mathematics, 3(4):450–465, 1990. doi:10.1137/0403039.
  • [4] Vedat Levi Alev and Lap Chi Lau. Improved analysis of higher order random walks and applications. In Proceedings of the 52nd Annual ACM SIGACT Symposium on Theory of Computing, pages 1198–1211, 2020. doi:10.1145/3357713.3384317.
  • [5] Yeganeh Alimohammadi, Nima Anari, Kirankumar Shiragur, and Thuy-Duong Vuong. Fractionally log-concave and sector-stable polynomials: counting planar matchings and more. In Proceedings of the 53rd Annual ACM SIGACT Symposium on Theory of Computing, pages 433–446, 2021. doi:10.1145/3406325.3451123.
  • [6] Nima Anari and Michał Dereziński. Isotropy and log-concave polynomials: Accelerated sampling and high-precision counting of matroid bases. In 2020 IEEE 61st Annual Symposium on Foundations of Computer Science (FOCS), pages 1331–1344. IEEE, 2020.
  • [7] Nima Anari, Michał Dereziński, Thuy-Duong Vuong, and Elizabeth Yang. Domain Sparsification of Discrete Distributions Using Entropic Independence. In Mark Braverman, editor, 13th Innovations in Theoretical Computer Science Conference (ITCS 2022), volume 215 of Leibniz International Proceedings in Informatics (LIPIcs), pages 5:1–5:23, Dagstuhl, Germany, 2022. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.ITCS.2022.5.
  • [8] Nima Anari, Kuikui Liu, and Shayan Oveis Gharan. Spectral independence in high-dimensional expanders and applications to the hardcore model. SIAM Journal on Computing, 53(6):FOCS20–1–FOCS20–37, 2024. doi:10.1137/20M1367696.
  • [9] Nima Anari, Kuikui Liu, Shayan Oveis Gharan, Cynthia Vinzant, and Thuy-Duong Vuong. Log-concave polynomials iv: approximate exchange, tight mixing times, and near-optimal sampling of forests. In Proceedings of the 53rd Annual ACM SIGACT Symposium on Theory of Computing, pages 408–420, 2021. doi:10.1145/3406325.3451091.
  • [10] Nima Anari, Yang P. Liu, and Thuy-Duong Vuong. Optimal sublinear sampling of spanning trees and determinantal point processes via average-case entropic independence. In 2022 IEEE 63rd Annual Symposium on Foundations of Computer Science (FOCS), pages 123–134, 2022. doi:10.1109/FOCS54457.2022.00019.
  • [11] Simon Apers and Ronald de Wolf. Quantum speedup for graph sparsification, cut approximation, and laplacian solving. SIAM Journal on Computing, 51(6):1703–1742, 2022. doi:10.1137/21M1391018.
  • [12] Arash Asadpour, Michel X. Goemans, Aleksander Mądry, Shayan Oveis Gharan, and Amin Saberi. An O(lognloglogn)-approximation algorithm for the asymmetric traveling salesman problem. In Proceedings of the 2010 Annual ACM-SIAM Symposium on Discrete Algorithms, pages 379–389, 2010. doi:10.1137/1.9781611973075.32.
  • [13] Antonio Blanca, Pietro Caputo, Zongchen Chen, Daniel Parisi, Daniel Štefankovič, and Eric Vigoda. On mixing of markov chains: Coupling, spectral independence, and entropy factorization. In Proceedings of the 2022 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 3670–3692, 2022. doi:10.1137/1.9781611977073.145.
  • [14] Sergey G Bobkov and Prasad Tetali. Modified logarithmic Sobolev inequalities in discrete settings. Journal of Theoretical Probability, 19:289–336, 2006.
  • [15] Julius Borcea, Petter Brändén, and Thomas Liggett. Negative dependence and the geometry of polynomials. Journal of the American Mathematical Society, 22(2):521–567, 2009.
  • [16] Andrei Z Broder. Generating random spanning trees. In FOCS, volume 89, pages 442–447, 1989. doi:10.1109/SFCS.1989.63516.
  • [17] Nicolo Cesa-Bianchi, Claudio Gentile, Fabio Vitale, Giovanni Zappella, et al. Random spanning trees and the prediction of weighted graphs. Journal of Machine Learning Research, 14(1):1251–1284, 2013. doi:10.5555/2567709.2502620.
  • [18] Zongchen Chen, Andreas Galanis, Daniel Štefankovič, and Eric Vigoda. Rapid mixing for colorings via spectral independence. In Proceedings of the 2021 ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1548–1557. SIAM, 2021.
  • [19] Charles J Colbourn, Wendy J Myrvold, and Eugene Neufeld. Two algorithms for unranking arborescences. Journal of Algorithms, 20(2):268–281, 1996. doi:10.1006/JAGM.1996.0014.
  • [20] Mary Cryan, Heng Guo, and Giorgos Mousa. Modified log-Sobolev inequalities for strongly log-concave distributions. The Annals of Probability, 49(1):506–525, 2021. doi:10.1214/20-AOP1453.
  • [21] Michal Derezinski, Burak Bartan, Mert Pilanci, and Michael W Mahoney. Debiasing distributed second order optimization with surrogate sketching and scaled regularization. Advances in Neural Information Processing Systems, 33:6684–6695, 2020.
  • [22] Michał Dereziński, Kenneth L Clarkson, Michael W Mahoney, and Manfred K Warmuth. Minimax experimental design: Bridging the gap between statistical and worst-case approaches to least squares regression. In Conference on Learning Theory, pages 1050–1069. PMLR, 2019.
  • [23] Michal Derezinski, Rajiv Khanna, and Michael W Mahoney. Improved guarantees and a multiple-descent curve for column subset selection and the nystrom method. Advances in Neural Information Processing Systems, 33:4953–4964, 2020.
  • [24] Michal Derezinski and Manfred KK Warmuth. Unbiased estimates for linear regression via volume sampling. Advances in Neural Information Processing Systems, 30, 2017.
  • [25] Michał Dereziński and Jiaming Yang. Solving dense linear systems faster than via preconditioning. In Proceedings of the 56th Annual ACM Symposium on Theory of Computing, pages 1118–1129, 2024.
  • [26] Leo L Duan, Zeyu Yuwen, George Michailidis, and Zhengwu Zhang. Low tree-rank bayesian vector autoregression models. Journal of Machine Learning Research, 24(286):1–35, 2023. URL: http://jmlr.org/papers/v24/22-0360.html.
  • [27] David Durfee, Rasmus Kyng, John Peebles, Anup B Rao, and Sushant Sachdeva. Sampling random spanning trees faster than matrix multiplication. In Proceedings of the 49th Annual ACM SIGACT Symposium on Theory of Computing, pages 730–742, 2017. doi:10.1145/3055399.3055499.
  • [28] David Durfee, John Peebles, Richard Peng, and Anup B Rao. Determinant-preserving sparsification of SDDM matrices with applications to counting and sampling spanning trees. In 2017 IEEE 58th Annual Symposium on Foundations of Computer Science (FOCS), pages 926–937. IEEE, 2017. doi:10.1109/FOCS.2017.90.
  • [29] Christoph Dürr, Mark Heiligman, Peter Høyer, and Mehdi Mhalla. Quantum query complexity of some graph problems. SIAM Journal on Computing, 35(6):1310–1328, 2006. doi:10.1137/050644719.
  • [30] Ronald M Foster. The average impedance of an electrical network. Contributions to Applied Mechanics (Reissner Anniversary Volume), 333, 1949.
  • [31] Shayan Oveis Gharan, Amin Saberi, and Mohit Singh. A randomized rounding approach to the traveling salesman problem. In 2011 IEEE 52nd Annual Symposium on Foundations of Computer Science, pages 550–559. IEEE, 2011. doi:10.1109/FOCS.2011.80.
  • [32] Navin Goyal, Luis Rademacher, and Santosh Vempala. Expanders via random spanning trees. In Proceedings of the twentieth annual ACM-SIAM symposium on Discrete algorithms, pages 576–585. SIAM, 2009. doi:10.1137/1.9781611973068.64.
  • [33] Lov K Grover. A fast quantum mechanical algorithm for database search. In Proceedings of the twenty-eighth annual ACM symposium on Theory of computing, pages 212–219, 1996. doi:10.1145/237814.237866.
  • [34] Alain Guenoche. Random spanning tree. Journal of Algorithms, 4(3):214–220, 1983. doi:10.1016/0196-6774(83)90022-6.
  • [35] Yassine Hamoudi. Preparing many copies of a quantum state in the black-box model. Physical Review A, 105:062440, June 2022. doi:10.1103/PhysRevA.105.062440.
  • [36] Nicholas JA Harvey and Keyulu Xu. Generating random spanning trees via fast matrix multiplication. In LATIN 2016: Theoretical Informatics: 12th Latin American Symposium, Ensenada, Mexico, April 11-15, 2016, Proceedings 12, pages 522–535. Springer, 2016. doi:10.1007/978-3-662-49529-2_39.
  • [37] Mark Herbster, Stephen Pasteris, Fabio Vitale, and Massimiliano Pontil. A gang of adversarial bandits. Advances in Neural Information Processing Systems, 34:2265–2279, 2021. URL: https://proceedings.neurips.cc/paper/2021/hash/124461dcd3571e6674ec4e0e140cc298-Abstract.html.
  • [38] Vishesh Jain, Huy Tuan Pham, and Thuy Duong Vuong. Spectral independence, coupling with the stationary distribution, and the spectral gap of the glauber dynamics. arXiv preprint arXiv:2105.01201, 2021. arXiv:2105.01201.
  • [39] Jonathan A Kelner and Aleksander Madry. Faster generation of random spanning trees. In 2009 50th Annual IEEE Symposium on Foundations of Computer Science, pages 13–21. IEEE, 2009. doi:10.1109/FOCS.2009.75.
  • [40] Gustav Kirchhoff. Ueber die auflösung der gleichungen, auf welche man bei der untersuchung der linearen vertheilung galvanischer ströme geführt wird. Annalen der Physik, 148(12):497–508, 1847.
  • [41] Hartmut Klauck, Robert Špalek, and Ronald De Wolf. Quantum and classical strong direct product theorems and optimal time-space tradeoffs. SIAM Journal on Computing, 36(5):1472–1493, 2007. doi:10.1137/05063235X.
  • [42] Alex Kulesza and Ben Taskar. k-dpps: Fixed-size determinantal point processes. In Proceedings of the 28th International Conference on Machine Learning (ICML-11), pages 1193–1200, 2011. URL: https://icml.cc/2011/papers/611_icmlpaper.pdf.
  • [43] Alex Kulesza, Ben Taskar, et al. Determinantal point processes for machine learning. Foundations and Trends® in Machine Learning, 5(2–3):123–286, 2012. doi:10.1561/2200000044.
  • [44] Vidyadhar G. Kulkarni. Generating random combinatorial objects. Journal of Algorithms, 11(2):185–207, 1990. doi:10.1016/0196-6774(90)90002-V.
  • [45] Yin Tat Lee and Santosh S Vempala. Eldan’s stochastic localization and the KLS conjecture: Isoperimetry, concentration and mixing. Annals of Mathematics, 199(3):1043–1092, 2024.
  • [46] David A Levin and Yuval Peres. Markov chains and mixing times, volume 107. American Mathematical Soc., 2017.
  • [47] Kuikui Liu. From Coupling to Spectral Independence and Blackbox Comparison with the Down-Up Walk. In Mary Wootters and Laura Sanità, editors, Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques (APPROX/RANDOM 2021), volume 207 of Leibniz International Proceedings in Informatics (LIPIcs), pages 32:1–32:21, Dagstuhl, Germany, 2021. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.APPROX/RANDOM.2021.32.
  • [48] Russell Lyons and Yuval Peres. Probability on trees and networks, volume 42. Cambridge University Press, 2017.
  • [49] Aleksander Madry, Damian Straszak, and Jakub Tarnawski. Fast generation of random spanning trees and the effective resistance metric. In Proceedings of the twenty-sixth annual ACM-SIAM symposium on Discrete algorithms, pages 2019–2036. SIAM, 2014.
  • [50] Cristopher Moore and Alexander Russell. Quantum walks on the hypercube. In Randomization and Approximation Techniques in Computer Science: 6th International Workshop, RANDOM 2002 Cambridge, MA, USA, September 13–15, 2002 Proceedings 5, pages 164–178. Springer, 2002. doi:10.1007/3-540-45726-7_14.
  • [51] Aleksandar Nikolov, Mohit Singh, and Uthaipon Tantipongpipat. Proportional volume sampling and approximation algorithms for a-optimal design. Mathematics of Operations Research, 47(2):847–877, 2022. doi:10.1287/MOOR.2021.1129.
  • [52] Peter C Richter. Quantum speedup of classical mixing processes. Physical Review A—Atomic, Molecular, and Optical Physics, 76(4):042306, 2007.
  • [53] Robin Richter, Shankar Bhamidi, and Sach Mukherjee. Improved baselines for causal structure learning on interventional data. Statistics and Computing, 33(5):93, 2023. doi:10.1007/S11222-023-10257-9.
  • [54] Mark Rudelson. Random vectors in the isotropic position. Journal of Functional Analysis, 164(1):60–72, 1999.
  • [55] Luís MS Russo, Andreia Sofia Teixeira, and Alexandre P Francisco. Linking and cutting spanning trees. Algorithms, 11(4):53, 2018. doi:10.3390/A11040053.
  • [56] Luís M. S. Russo, Andreia Sofia Teixeira, and Alexandre P. Francisco. Linking and cutting spanning trees. Algorithms, 11(4), 2018. doi:10.3390/a11040053.
  • [57] Aaron Schild. An almost-linear time algorithm for uniform random spanning tree generation. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, pages 214–227, 2018. doi:10.1145/3188745.3188852.
  • [58] James Sharpnack, Aarti Singh, and Akshay Krishnamurthy. Detecting activations over graphs using spanning tree wavelet bases. In Artificial intelligence and statistics, pages 536–544. PMLR, 2013. URL: http://proceedings.mlr.press/v31/sharpnack13a.html.
  • [59] Daniel A. Spielman and Nikhil Srivastava. Graph sparsification by effective resistances. SIAM Journal on Computing, 40(6):1913–1926, 2011. doi:10.1137/080734029.
  • [60] Leonardo V Teixeira, Renato M Assunção, and Rosangela H Loschi. Bayesian space-time partitioning by sampling and pruning spanning trees. Journal of Machine Learning Research, 20(85):1–35, 2019. URL: https://jmlr.org/papers/v20/16-615.html.
  • [61] David Bruce Wilson. Generating random spanning trees more quickly than the cover time. In Proceedings of the twenty-eighth annual ACM symposium on Theory of computing, pages 296–303, 1996. doi:10.1145/237814.237880.

Appendix A Useful Theorems

In this part, we revisit some useful quantum algorithms.

By first applying the quantum graph sparsification algorithm, and then computing the approximate effective resistance on the sparisified graph, we can obtain a quantum speedup for approximating effective resistance overestimates. This is characterized by the following theorem.

Proposition 25 (Quantum Algorithms for the Effective Resistance Overestimates, Adapted from [11, Claim 7.9]).

Assume quantum query acces 𝒪G to G=(V,E,w). There is a quantum data structure 𝖰𝖱𝖾𝗌𝗂𝗌𝗍𝖺𝗇𝖼𝖾, that takes in the accuracy parameter ε(0,1/3), and supports the following operations:

  • Initialization 𝖰𝖱𝖾𝗌𝗂𝗌𝗍𝖺𝗇𝖼𝖾𝖨𝗇𝗂𝗍(G,ε): outputs an instance of 𝖰𝖱𝖾𝗌𝗂𝗌𝗍𝖺𝗇𝖼𝖾. This operation uses O~(mn/ε) queries to 𝒪G, and runs in O~(mn/ε+n/ε4) time.

  • Query .𝖰𝗎𝖾𝗋𝗒: outputs a unitary satisfying

    .𝖰𝗎𝖾𝗋𝗒|a|b|0=|a|b|R~ab

    with RabR~ab(1+ε)Rab for every pair of vertices a,bV, where Rab is the effective resistance between vertices a and b in graph G. The operation runs in O~(1/ε2) time.

Proof.

Originally the quantum algorithm in [11, Claim 7.9] provides query access to the estimate Rab of the effective resistance satisfying (1ε)RabRab(1+ε)Rab. Therefore, for our purpose, it suffices to take ε=ε/3 and R~ab=Rab/(1ε) in their algorithm.

The following theorem allows us to obtain a quantum speedup for the task of preparing multiple copies of a state.

Theorem 26 (Preparing many copies of a quantum state, [35, Theorem 1]).

There exists a quantum algorithm 𝖬𝗎𝗅𝗍𝗂𝖯𝗋𝖾𝗉𝖺𝗋𝖾(𝒪w,k) that, given oracle access 𝒪w to a vector w0n (0-indexed), and k[n], with high probability, outputs k copies of the state |w, where |w=1Wi[n]0wi|i with W=i[n]0wi. The algorithm uses O~(nk) queries to 𝒪w, and runs in O~(nk) time.

We further recall the quantum algorithm for finding a minimum spanning tree proposed in [29].

Theorem 27 (Quantum algorithm for finding a minimum spanning tree, Theorem 4.2 in [29]).

There exists a quantum algorithm 𝖰𝖬𝗂𝗇𝖳𝗋𝖾𝖾(𝒪G) that, given query access 𝒪G to an undirected weighted graph G=(V,E,w) with |V|=n and |E| = m, with high probability, outputs a minimum spanning tree of G. The algorithm uses O(mn) queries to 𝒪G and runs in O~(mn) time.

In our paper, we need to find a spanning tree with maximal weight product in an undirected weighted graph. This could be done by directly applying above algorithm to the same graph with slight modifications of weight. We give more details in the following.

Corollary 28 (Quantum algorithm for finding a maximum spanning tree, Adapted from Theorem 4.2 in [29]).

There exists a quantum algorithm 𝖰𝖬𝖺𝗑𝖯𝗋𝗈𝖽𝗎𝖼𝗍𝖳𝗋𝖾𝖾(𝒪G) that, given adjacency query access 𝒪G to an undirected weighted graph G=(V,E,w) with |V|=n and |E| = m, and weight w bounded by some constant W, with high probability, outputs a maximum weight-product spanning tree of G. The algorithm uses O(mn) queries to 𝒪G and runs in O~(mn) time.

Proof.

Note that a maximum weight-product spanning tree of G=(V,E,w) corresponds to a minimum spanning tree of the graph G=(V,E,w), with we=log(W/we) for all eE. Given query access to G, a query access to G can be constructed in O~(1) time. Therefore, by applying Theorem 27, we know 𝖰𝖬𝗂𝗇𝖳𝗋𝖾𝖾(𝒪G) is what we need.