SimRank

Given a directed graph G=<V,E>G = \left< V, E \right>, the SimRank score s(i,j)s(i,j) for each i,j∈Vi, j \in V measures the similarity between vertices ii and jj, defined as thus

s(i,j)={1, if i=jc∣I(i)∣∣I(j)∣∑a∈I(i),b∈I(j)s(a,b),otherwise s(i,j) = \begin{cases} 1, &\text{ if } i = j \\ \frac{c}{|I(i)| |I(j)|} \sum_{a \in I(i), b \in I(j)} s(a,b), &\text{otherwise} \end{cases}

where I(i)I(i) is the set of in-neighbors of i∈Vi \in V, and c∈(0,1)c \in (0, 1).

Interpretations

First Meeting Time of Non-Stop Random Walks

s(i,j)s(i,j) can be interpreted as the value of

E[cTi,j], \mathbb{E}\left[ c^{T_{i,j}} \right],

where Ti,jT_{i,j} is the random variable of the first time that a reverse random walk (a random walk that travel along the incoming edges of a vertex uniformly at random) from ii and a reverse random walk from jj meets. Note that

Ti,j={0, if i=j1∣I(i)∣∣I(j)∣∑a∈I(i),b∈I(j)Ta,b,otherwise. T_{i,j} = \begin{cases} 0, &\text{ if } i = j \\ \frac{1}{|I(i)| |I(j)|} \sum_{a \in I(i), b \in I(j)} T_{a,b}, &\text{otherwise} \end{cases}.

Therefore,

E[cTi,j]=c0⋅Pr⁡[Ti,j=0]+1∣I(i)∣∣I(j)∣∑a∈I(i),b∈I(j)E[c1+Ta,b]=Ii=j+c∣I(i)∣∣I(j)∣∑a∈I(i),b∈I(j)E[cTa,b]=Ii=j+c∣I(i)∣∣I(j)∣∑a∈I(i),b∈I(j)s(a,b). \begin{aligned} \mathbb{E}\left[ c^{T_{i,j}} \right] &= c^0 \cdot \Pr[T_{i,j} = 0] + \frac{1}{|I(i)| |I(j)|} \sum_{a \in I(i), b \in I(j)} \mathbb{E}\left[c^{1 + T_{a, b}} \right] \\ &= \mathbb{I}_{i = j} + \frac{c}{|I(i)| |I(j)|} \sum_{a \in I(i), b \in I(j)} \mathbb{E}\left[c^{ T_{a, b}} \right] \\ &= \mathbb{I}_{i = j} + \frac{c}{|I(i)| |I(j)|} \sum_{a \in I(i), b \in I(j)} s(a, b). \end{aligned}

Meeting Probability of c\sqrt{c}-Random Walks

There is another random walk interpretation fo SimRank:

  1. First, notice that when i≠ji \neq j, [TX16] rewrites the SimRank as
s(i,j)=cc∣I(i)∣∣I(j)∣∑a∈I(i),b∈I(j)s(a,b) s(i,j) = \frac{ \sqrt c \sqrt c} {|I(i)| |I(j)|} \sum_{a \in I(i), b \in I(j)} s(a,b)
  1. Second, [TX16] defines the c\sqrt c-random walk as

    • In any step, the walk stops with probability 1−c1 - \sqrt c.
    • With the other c\sqrt c probability, the walk chose the in-neighbors of the current vertex uniformly at random.
  2. Finally s(i,j)s(i,j) is interpreted as

    The probability of two c\sqrt c random walks ever meet, such that one of the random walks starts at vertex ii and the other starts at jj.

Computation

Monte Carlo

A straightforward solution is to perform Monte Carlo simulation to calculate s(i,j)s(i,j)--we initialize two c\sqrt{c}-random walks from ii and jj respectively, and simulate the two walks until they meet, or either walk stops.

We need not to worry about that this process continues forever. Since the expected number of steps of a c\sqrt c random walk is given by

c+c2+c3+......=c1−c \sqrt c + \sqrt c^2 + \sqrt c^3 + ...... = \frac{ \sqrt c}{ 1 - \sqrt c}

which is a constant.

Chernoff Bound

We repeat this process tt times. Let XkX_k be indicate for the event that the two walks meet in the kk-th trial. It is easy to see that Xk,k∈[t]X_k, k \in [t] is a sequence of i.i.d random variables with E[Xk]=s(i,j)\mathbb{E}[ X_k ] = s(i, j).

Let Xˉ≐(1/t)⋅∑k∈[t]Xk\bar{X} \doteq (1 / t) \cdot \sum_{k \in [t]} X_k and μ≐s(i,j)\mu \doteq s(i,j). By Chernoff Bound,

Pr⁡[∣Xˉ−μ∣>(1+λ)μ]≤2exp⁡(−tμλ23)=δ, \Pr \left[ {| \bar{X} - \mu | > (1 + \lambda) \mu } \right] \le 2 \exp \left(- \frac{t \mu \lambda^2}{3} \right) = \delta,

where λ\lambda is relative error ratio and δ\delta the error probability we would like to achieve.

Time Complexity

The previous section implies t=3μλ2log⁡2δt = \frac{3 }{ \mu \lambda ^2}\log \frac{ 2 }{ \delta }. By setting ϵ=(1+λ)μ⇔λ=ϵμ−1\epsilon = (1 + \lambda) \mu \Leftrightarrow \lambda = \frac{\epsilon}{\mu} - 1, we get

t=3μ(ϵμ2−2ϵμ+1)log⁡2δ=O(μϵ2log⁡1δ). t = \frac{ 3 }{ \mu \left( \frac{\epsilon}{\mu}^2 - 2\frac{\epsilon}{\mu} + 1 \right) }\log \frac{ 2 }{ \delta } = O \left( \frac{ \mu }{ \epsilon^2 }\log \frac{ 1 }{ \delta } \right).

Notice that when ϵ\epsilon is small, say 0.010.01, 1ϵ2\frac{1}{\epsilon^2} is large thus can not be neglected. The problem remains whether we could reduce the number of random walks.

Index

Another acute observation from [TX16] is that if two walks reach the same vertex, their following behavior follows the same probability distribution (since the walks are memoryless).

Motivated by this, define hiℓ(k)h_i^\ell(k) as the hitting probability such that a walk begins at vertex ii and reaches vertex jj at the ℓ\ell-th step. hiℓ(k)h_i^\ell(k) can be updated iteratively using

hiℓ(k)=c∣I(i)∣∑j∈I(i)hjℓ−1(k) h_i^\ell(k) = \frac{ \sqrt c }{ |I(i) | } \sum_{j \in I(i)} h_j^{\ell -1}(k)

SimRank and Hitting Probability

Now we consider about bridging the gap between SimRank score and hitting probability.

For each i,j∈Vi, j \in V, define the indicator I(i,j)\mathbb{I} (i,j) for the event that two c\sqrt{c}-random walks starting from ii and jj respectively ever meet.

E[I(i,j)]=s(i,j). \mathbb{E}[\mathbb{I} (i,j)] = s(i,j).

I(i,j,k,ℓ)\mathbb{I} (i, j, k, \ell) the indicator the event that two random walks, starting from ii and jj respectively, meet at ℓ\ell-th step at kk and this is the last time they meet. In other word, these two walk never meet again after ℓ\ell-th step at kk. It is easy to see that for different kk and ℓ\ell, the events indicated by the I(i,j,k,ℓ)\mathbb{I} (i, j, k, \ell)'s are mutually disjoint. Therefore,

I(i,j)=∑k∑ℓI(i,j,k,ℓ). \mathbb{I} (i,j) = \sum_k \sum_\ell \mathbb{I} (i, j, k, \ell).

Let dkd_k be the probability that two walks from kk never meet except for the first step. Then

E[I(i,j,k,ℓ)]=hiℓ(k)hjℓ(k)dk, \mathbb{E} \left[\mathbb{I} (i, j, k, \ell) \right] = h_i^\ell(k) h_j^\ell(k) d_k,

and

E[I(i,j)]=E[∑k∑ℓI(i,j,k,ℓ)]=∑ℓ=0∞∑k=1nE[I(i,j,k,ℓ)]=∑ℓ=0∞∑k=1nhiℓ(k)hjℓ(k)dk. \begin{aligned} \mathbb{E} \left[ \mathbb{I} (i,j) \right] &= \mathbb{E} \left[\sum_k \sum_\ell \mathbb{I} (i, j, k, \ell) \right] \\ &= \sum_{\ell = 0}^{\infty} \sum_{k = 1}^{n} \mathbb{E} \left[\mathbb{I} (i, j, k, \ell) \right] \\ &= \sum_{\ell = 0}^{\infty} \sum_{k = 1}^{n} h_i^\ell(k) h_j^\ell(k) d_k. \end{aligned}

Truncation

Notice that for a given ii, there infinity many hiℓ(k)h_i^\ell(k)'s we need to kept, which is unfeasible. To get around this, we only keep the hiℓ(k)h_i^\ell(k)'s greater than ϵh\epsilon_h, where ϵh=O(ϵ)\epsilon_h = O(\epsilon).

The probability that the c\sqrt c-random walk does not to stop before ℓ\ell-th step is cℓ\sqrt c ^\ell, i.e.,

∑k=1nhiℓ(k)=cℓ. \sum_{k = 1}^n h_i^\ell(k) = \sqrt c^\ell.

For a fixed ℓ\ell, at most cℓ/ϵh\sqrt c ^\ell / \epsilon_h number of hiℓ(k)h_i^\ell(k)'s are kept. So the total number of hiℓ(k)h_i^\ell(k)'s kept is bounded by

1ϵh(c+c2+c3+......)=O(1ϵh)=O(1ϵ). \frac{1}{\epsilon_h} (\sqrt c + \sqrt c^2 + \sqrt c^3 + ...... ) = O \left( \frac{1}{\epsilon_h} \right) = O \left( \frac{1}{\epsilon} \right).

On the other hand, estimation of dkd_k could be done by monte carlo simulation. By Chernoff bound, we can show that with

O(1ϵd2log⁡1δd) O \left( \frac{1}{\epsilon_d^2} \log \frac{1}{\delta_d} \right)

samples, dkd_k could be estimated by dkˉ\bar{d_k} such that ∣dkˉ−dk∣<ϵd| \bar{d_k} - d_k| < \epsilon_d holds with at least 1−δd1 - \delta_d probability, where ϵd=O(ϵ)\epsilon_d = O(\epsilon).

Reference

[TX16] Boyu. Tian and Xiaokui. Xiao SLING: A Near-Optimal Index Structure for SimRank. SIGMOD'16