To perform one step of random walk in the random walk kernel, we need to apply the adjacency matrix of the product graph to the probability of current node. In the line P*=XY, it is equivalent to np.multiply (element-wise multiplication). But we actually need np.matmul (matrix multiplication) instead. So the correct one should be P = np.matmul(XY, P) to perform one step of random walk.
if self.p is not None:
P = np.eye(XY.shape[0])
S = self._mu[0] * P
for k in self._mu[1:]:
P *= XY
S += k*P
To perform one step of random walk in the random walk kernel, we need to apply the adjacency matrix of the product graph to the probability of current node. In the line
P*=XY
, it is equivalent to np.multiply (element-wise multiplication). But we actually need np.matmul (matrix multiplication) instead. So the correct one should beP = np.matmul(XY, P)
to perform one step of random walk.