dgl.transform.khop_adj(g, k)[source]

Return the matrix of $$A^k$$ where $$A$$ is the adjacency matrix of $$g$$, where a row represents the destination and a column represents the source.

Parameters: g (dgl.DGLGraph) – The input graph. k (int) – The $$k$$ in $$A^k$$. The returned tensor, dtype is np.float32. tensor

Examples

>>> import dgl
>>> g = dgl.DGLGraph()