# dgl.transform.khop_graph¶

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

Return the graph that includes all $$k$$-hop neighbors of the given graph as edges. The adjacency matrix of the returned graph is $$A^k$$ (where $$A$$ is the adjacency matrix of $$g$$).

Parameters: g (dgl.DGLGraph) – The input graph. k (int) – The $$k$$ in k-hop graph. The returned DGLGraph. dgl.DGLGraph

Examples

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