Is the normalized graph laplacian row stochastic?

729 Views Asked by At

Let $W$ be the adjacency matrix of a graph $G$, where $w_{ij} \in \{0, 1\}$ for an unweighted graph, or real values otherwise. And let $D$ be the diagonal weight matrix, where $D_{i, i} = \sum_j w_{i, j}$.

Is the normalized graph laplacian of $W$, $\widetilde{W} = D^{-1/2} W D^{-1/2}$, row stochastic? That is, is it true that $\sum_j \widetilde{W}_{i, j} = 1$?

I have multiple sources (1, 2, 3) that use $\widetilde{W}$ in a random walk with restart (pagerank) framework. However, my code below, which calculates the normalized graph laplacian, does not yield a row stochastic matrix.

>>> """
>>> The graph
>>> 
>>> (A) ---- (B) ---- (D)
>>>    \      /
>>>     \   /
>>>      (C)
>>> """
>>> G = nx.Graph()
>>> G.add_nodes_from("ABCD")
>>> G.add_edges_from([("A", "B"), ("B", "D"), ("D", "B"), ("B", "C"), ("A", "C")])
>>> 
>>> W = nx.to_scipy_sparse_matrix(G, nodelist=sorted(G.nodes()))
>>> W.toarray()
array([[0, 1, 1, 0],
       [1, 0, 1, 1],
       [1, 1, 0, 0],
       [0, 1, 0, 0]])
>>> 
>>> # Now composing D^{-1/2}
>>> diags = W.sum(axis=1).flatten()
>>> with scipy.errstate(divide="ignore"):
>>>     diags_inv_sqrt = 1.0 / scipy.sqrt(diags)
>>> diags_inv_sqrt[scipy.isinf(diags_inv_sqrt)] = 0
>>> diags_inv_sqrt = scipy.sparse.spdiags(diags_inv_sqrt, [0], *A.shape)
>>> 
>>> W_tilde = DH.dot(W).dot(DH)
array([[ 0.        ,  0.40824829,  0.5       ,  0.        ],
       [ 0.40824829,  0.        ,  0.40824829,  0.57735027],
       [ 0.5       ,  0.40824829,  0.        ,  0.        ],
       [ 0.        ,  0.57735027,  0.        ,  0.        ]])
1

There are 1 best solutions below

2
On BEST ANSWER

In general it is not. The transition matrix for the random walk is $D^{-1}W$ (which is row stochastic) and this matrix is similar to $D^{-1/2}WD^{1/2}$ if $G$ has no isolated vertices.