How to Calculate Quantum PageRank on IBM's Quantum Computer

I ran a slightly absurd and really fun experiment. I took this blog's link graph, translated PageRank into its quantum version and ran it on one of the quantum computers IBM has in the cloud, something nobody had ever done until now 🙂

And it worked! There's a job ID (d8e52hhvjngc73ant800, in case anyone wants to check it) that proves the circuit ran on an IBM chip and not in a simulation.

Before you waste your time, let me warn you right away... it's useless for SEO. But if you're a nerd, I bet you'll want to keep reading.

Below I explain where the idea comes from, what exactly I did and why Google wouldn't do this even if it wanted to.

You don't need to know any physics, because I'll explain everything so it's easy to follow.

PageRank simulates a surfer stumbling randomly around the Internet...

The original definition of PageRank (Brin and Page, 1998) is recursive and a bit circular: a page is important if important pages link to it, and those pages are important if other important pages link to them, and so on forever. Which is a big problem, because that's impossible to calculate.

To make it computable, Brin and Page explained it with a model that ended up being even more famous than the formula itself: the random surfer.

Imagine someone browsing aimlessly: they land on a page, click a random link, reach another page, click another link, and keep going like that for hours. Every now and then they get bored and, instead of following a link, jump to a random page on the site (that's the famous damping factor of 0.85: 85% of the time they follow a link, 15% of the time they jump). A page's PageRank is the fraction of time the surfer spends on it.

The cool thing is that both approaches give exactly the same result. The recursive definition and the time the surfer spends on each page match down to the last decimal.

Keep the random surfer in mind, because that's what changes with the quantum version of PageRank. Mathematically, the surfer is a Markov chain: the only thing that decides the next step is where you are now, not how you got there. A regular computer solves this in no time, and even for the entire web it's trivial and efficient. I implemented it in 2011, after a debate on Twitter, and the code fit in half a screen.

...and the quantum version swaps the dice for a wave

In 2012, two physicists (Giuseppe Paparo and Miguel Ángel Martín-Delgado) published an article in Scientific Reports titled Google in a Quantum Network. They asked themselves: what if, instead of a surfer who rolls the dice at every step, you use one that behaves like a wave?

The classical surfer is always on one specific page, but the quantum surfer is spread across many pages at once, in what's called a superposition. And the different paths it could take interfere with each other, like waves on water, which add up at some points and cancel out at others. That interference makes the "probability" of ending up on each page spread out differently than in the classical version.

Schematic outline and summary of the quantum pagerank algorithm

And this gets SUPER heavy to compute, because the quantum surfer's state is which page I'm coming from and which one I'm going to. In other words, if your site has N pages, the possible pairs are N times N, that is, N². For the 123 pages on my blog, that's about 15,000 possible states.

The engine behind this whole contraption is called the Szegedy walk. So the algorithm isn't mine; all I do is apply it to my blog. What is new is running it on a real quantum computer, because Paparo and co. simulated it on regular computers. As far as I could find, nobody had ever put the quantum walk of a real website on a physical quantum chip.

Before starting, I replicated the example they publish in the paper: a little tree with 7 nodes on 3 levels, with specific values in a table. My code had to return those same numbers, and it did, matching to four decimal places. From then on I knew we were on the right track.

The findings they describe in their paper also show up in my data: the ranking gets reshuffled, "secondary hubs" emerge that the classical version didn't highlight, and the tail of poorly linked pages gets redistributed. There's one claim of theirs I couldn't properly reproduce, the greater stability against changes in the damping factor, but that property requires averaging over many different graphs and I only have one. I'm mentioning it so I don't sell you something I didn't see.

Calculating my blog's Quantum PageRank on IBM's quantum computer

I took a small chunk of the blog (you'll see why later), just 4 pages that link to each other (the homepage, the article index and two posts), and sent the circuit to ibm_marrakesh, which has a 156-qubit processor.

The result is interesting: classical PageRank for that little group puts the article index on top, above the homepage. The quantum version flips it and puts the homepage first. And I checked that it's not an error, because the ideal simulated calculation predicts it, and the chip, noise and all, sticks to it. So the homepage wins.

quantum-pagerank

The homepage bar on the chip comes out higher than it should. It turns out that a qubit, if you leave it alone, loses energy and falls to its resting state, the one we label |0⟩ (read "ket zero", it's a qubit set to zero). It's like a spinning top that, as it slows down, always tends to stop in the same position. That's called relaxation, and since these circuits are long, many qubits have time to doze off into 0 before we measure them. The result is biased toward the all-zeros string, |00⟩ ("ket zero zero" = two qubits at zero).

And why does it hit the homepage specifically? Because of the way I numbered the pages, the homepage is number 0, which in binary is exactly |00⟩. So the chip's natural tendency to fall into |00⟩ gets confused with the surfer ending up on the homepage. Part of that tall bar is legit, because the ideal calculation also puts the homepage first, but another part is this artifact: the chip mixes up having relaxed into |00⟩ with the homepage having won.

To clean it up I used two standard techniques. The first, dynamical decoupling, inserts quick pulses during the moments when a qubit is just sitting there waiting, so noise from its neighbors doesn't knock it out of tune (it won't keep it from dozing off, but it does prevent other errors). The second, twirling, repeats the experiment many times while randomly changing small details of how the gates are applied, so an error that always pulls in the same direction turns into random noise that cancels out when you average. Instead of being wrong the same way every time, you're wrong in a different way each time, and the average comes out cleaner.

With both, the gap between what the chip returns and the ideal calculation was cut in half, and the homepage bar dropped toward where it should be. That said, let's be clear... it's still a 4-node toy experiment.

So why can't I run the whole blog?

Because of the wall. To run the Szegedy walk on a quantum chip, you have to translate it into "gates", which are the processor's basic operations. The annoying ones are the 2-qubit gates, because each one adds a bit of noise. And the number of gates grows brutally with the size of the graph:

Mov2 wall

With 4 pages it's about 180 two-qubit gates on the chip, and you can still make something out. But with 8 pages you jump to about 3,700 gates, and at that depth the probability of the circuit surviving without a single error is roughly 0.99 to the power of 3,700, which is practically zero. The result is pure uniform garbage. You can see that the ideal calculation for those 8 pages has a clear structure, but what the chip spits out is indistinguishable from rolling a die.

quantum pr noise

For the full blog, 123 pages, you'd need on the order of 270 million gates, in other words, science fiction. And here I thought this was a qubit problem, but no. For 123 pages about 14 qubits would be enough, and today's chips have hundreds. The problem is the depth of the circuit and the noise it accumulates. So now I understand why the inventors of the formula themselves never ended up putting it on hardware, even now that it's possible, and stuck to simulating it on a CPU, where all of this is trivial.

For the curious, this is the circuit I had to build for 4 URLs:

Quantum PageRank circuit transpiled for ibm_marrakesh

Scroll horizontally to see the full circuit.

Does the ranking change? Yes, but not for the better

So I did the same thing the inventors did: a quantum PageRank simulation using the whole blog. That way we can see whether computing the quantum PageRank of all 123 pages tells me something the classical one doesn't.

On the one hand, the two rankings are fairly similar overall. The Spearman correlation between them is 0.85, which is high. On the other hand, what does change is the "head" of my blog: of the top 10 pages in the classical ranking, only 4 are still in the quantum top 10, and the number 1 spot changes. More than half of the pages move 10 positions or more.

quantum-pr divergence

And what do I do with that as an SEO? Nothing. It's another centrality measure, different and mathematically legitimate. But there's no reason to think its order is the "right" one, the one that matters for rankings. It's just different, not better.

Would it make sense for Google to do this?

No. And it's worth understanding why, because it shows what a quantum computer is really good for:

  1. First: PageRank is already computed super fast on regular computers. It's what computer scientists call an "easy" problem, one with polynomial cost, so there's nothing to speed up.
  2. Second: the quantum version isn't faster either. That sounds weird after all that talk about the N² space, but it turns out all the action happens in a small corner of that space (with a size proportional to N, not N²), so a regular computer only needs to track that corner. It gives no speed advantage; it's just a different ranking.
  3. And third: running it on a quantum chip at web scale is impossible because of the wall I just described.

A quantum computer is a tool for very specific problems where it has been shown to win, like factoring huge numbers (which would break part of today's cryptography), simulating the behavior of molecules and materials, and certain kinds of search and optimization.

PageRank isn't one of those. It's computationally cheap, and putting it on a quantum machine means bringing a super expensive, fragile instrument to a task a laptop could already do in no time.

I've been reading a lot about quantum computing for years, and the lesson I've learned is that most of the problems we have today aren't the kind a quantum computer solves better. Here's why.

The dequantization story

In 2018, an 18-year-old undergraduate, Ewin Tang, was doing her thesis with Scott Aaronson (huge fan of this guy) at the University of Texas at Austin. Her assignment was to prove that a trendy quantum algorithm for recommendation systems (the one by Kerenidis and Prakash, the kind of engine behind "products you might also like") couldn't be matched by a regular computer. She spent months trying to prove that impossibility, until she started to suspect exactly the opposite. She ended up building a classical algorithm that matched the quantum one and was exponentially faster than any previous classical attempt. So the supposed quantum superpower wasn't where everyone thought it was.

That move is now called dequantization. It means taking a quantum algorithm that boasts of being exponentially faster and finding a classical one that does the same thing. Since Tang's work, quite a few have fallen, including quantum algorithms for recommendation systems, principal component analysis, solving linear systems and support vector machines. Basically, the "quantum advantage" came from comparing against a mediocre classical method, not against the best one available. As soon as someone bothered to look for the best classical method, the advantage evaporated.

Quantum PageRank is the same thing: an expensive contraption.

What this was good for

As an experiment, it's great. It's real research, run for the first time on quantum hardware, and on my own site's graph. I got to see how an algorithm is translated into "gates", the noise wall problem and why qubits aren't the bottleneck.

As an SEO tool it's worthless. I'm warning you in case some GEO bro decides to sell you a "Quantum Prompt Tracker", although, well... with the Schrödinger visibility scores they return, prompt trackers really are a bit quantum.

Tip: if you want to play around with a quantum computer, IBM gives you 10 free minutes of compute time per month. Learn to factor huge numbers or simulate a molecule. For ranking pages, the surfer stumbling around at random is still all you need.

The only useful thing I got out of it came by accident

On the first pass, the quantum calculation rescued 2 pages that the classical one had buried at the bottom of the ranking. For a second I got excited, thinking I'd found something. I went to check which pages they were, and it turned out one was a 301 redirect and the other a broken internal link, a 404, which had slipped into the graph as nodes. The "quantum finding" was my own linking mistakes...

So the most actionable thing in the whole experiment was that it forced me to clean up two bad internal links. Using a quantum computer for that: priceless 😅

Methodology and data

The graph comes from a Screaming Frog crawl (the All Inlinks report). The nodes are the internal URLs and the edges are the internal links. I filtered to links of type Hyperlink, with a follow attribute and a 200 response, without duplicates, which leaves 1,091 edges. For the analysis in this post I only keep the links that live in the content (503 edges), not in the menu, header or footer, because sitewide links distribute authority in a way that says nothing about each page's editorial importance. Damping of 0.85 and uniform teleportation, just as Paparo sets it up.

The code, in case you want to reproduce it

Here are both pieces of code, ready to copy. The first one is the Quantum PageRank engine and only needs NumPy. It already includes Paparo's tree as an example, so when you run it you should see the numbers from their Table 1. The second one runs the walk on an IBM quantum computer with Qiskit (you need a free account and your credentials saved with QiskitRuntimeService.save_account(...)).

Simulated Quantum PageRank (Python, NumPy only)
import numpy as np

def quantum_pagerank(G, steps=2000):
    """Paparo's Quantum PageRank (Szegedy walk, 2012).
    G = column-stochastic Google matrix (its columns sum to 1).
    Returns (mean, std dev) of I_q per node."""
    N = G.shape[0]
    A = np.zeros((N*N, N)); sq = np.sqrt(G)        # columns |psi_j> = |j> x sum_i sqrt(G_ij)|i>
    for j in range(N):
        A[j*N:(j+1)*N, j] = sq[:, j]
    def U(x):                                       # walk step: U = S (2 A A^T - I)
        Rx = 2*(A @ (A.T @ x)) - x                  # reflection
        return Rx.reshape(N, N).T.reshape(-1)       # swap
    psi = A @ (np.ones(N)/np.sqrt(N))               # initial state
    serie = np.empty((steps, N))
    for m in range(steps):
        serie[m] = (np.abs(psi.reshape(N, N))**2).sum(axis=0)   # marginal of the 2nd register
        psi = U(U(psi))                             # advance U^2 (measured at even steps)
    return serie.mean(0), serie.std(0)

def google_matrix(edges, N, alpha=0.85):
    """Column-stochastic G from edges (source, target). Dangling -> uniform teleportation."""
    S = np.zeros((N, N))
    for src, dst in edges:
        S[dst, src] += 1                            # the column is the source node
    out = S.sum(axis=0)
    for j in range(N):
        S[:, j] = S[:, j]/out[j] if out[j] else 1.0/N
    return alpha*S + (1-alpha)/N

# Example: Paparo's binary tree (7 nodes, child->parent edges).
# Reproduces their Table 1 -> quantum per level ~ [0.356, 0.151, 0.085].
edges = [(1,0),(2,0),(3,1),(4,1),(5,2),(6,2)]
media, desv = quantum_pagerank(google_matrix(edges, N=7))
print(media.round(3))
Running it on an IBM quantum computer (Qiskit)
import numpy as np
from qiskit import QuantumCircuit, ClassicalRegister, transpile
from qiskit.circuit.library import UnitaryGate
from qiskit_ibm_runtime import QiskitRuntimeService, SamplerV2

def walk_operator(G):
    """U = S (2 A A^T - I) as a dense N^2 x N^2 matrix (small N only: 4-8 nodes)."""
    N = G.shape[0]
    A = np.zeros((N*N, N)); sq = np.sqrt(G)
    for j in range(N): A[j*N:(j+1)*N, j] = sq[:, j]
    R = 2*(A @ A.T) - np.eye(N*N)
    idx = np.arange(N*N); a, b = idx//N, idx % N
    S = np.zeros((N*N, N*N)); S[b*N + a, idx] = 1.0
    return S @ R

def run_on_ibm(G, t=1, shots=8192, mitigate=True):
    """Runs U^t on the least busy QPU. Returns the 2nd register's distribution and the gates.
    Requirement: save your account first with
    QiskitRuntimeService.save_account(channel='ibm_quantum_platform', token=..., instance=...)."""
    N = G.shape[0]; k = int(round(np.log2(N)))          # qubits per register
    Ut = np.linalg.matrix_power(walk_operator(G), t)
    qc = QuantumCircuit(2*k)
    qc.append(UnitaryGate(Ut), range(2*k))              # the whole walk as a single gate
    creg = ClassicalRegister(k, "meas")
    qc.add_register(creg); qc.measure(range(k), creg)   # measure only the 2nd register (low qubits)
    backend = QiskitRuntimeService().least_busy(operational=True, simulator=False)
    tqc = transpile(qc, backend=backend, optimization_level=3)
    sampler = SamplerV2(mode=backend)
    if mitigate:                                        # noise suppression
        sampler.options.dynamical_decoupling.enable = True
        sampler.options.dynamical_decoupling.sequence_type = "XY4"
        sampler.options.twirling.enable_gates = True
        sampler.options.twirling.enable_measure = True
    counts = sampler.run([tqc], shots=shots).result()[0].data.meas.get_counts()
    m = np.zeros(N)
    for bits, c in counts.items(): m[int(bits, 2)] += c
    return m/m.sum(), tqc.count_ops()

# G is the same Google matrix from the previous block (use 4 or 8 nodes so it fits).
# dist, puertas = run_on_ibm(G, t=1)

Natzir Turrado 31 May 2026

Share

Facebook Linkedin Twitter

More articles

How to Analyze a Website's Technology

Before starting an SEO project, it's important to know what technology a website is built on. Is it Salesforce? When did they switch CMS? Is it a custom-built site? Is it using a JavaScript framework? What caching systems does it use? Is it on Cloudflare or something similar, so you can use workers to get […]

Read more

How to Increase Organic Traffic by Improving Crawl Frequency

I always say it's better to swim with search engine algorithms than against them, and this post is a good example of that. In it I'm going to explain the concept of “crawl frequency” and why optimizing it is so vital (especially on large sites) for improving organic traffic. Understanding crawl frequency As Google explains […]

Read more