dgl.DGLGraph.successors

DGLGraph.successors(v)

Return the successors of node v in the graph.

Node u is a successor of v if an edge (v, u) exist in the graph.

Parameters:v (int) – The node.
Returns:Array of successor node IDs.
Return type:tensor

Examples

The following example uses PyTorch backend.

>>> G = dgl.DGLGraph()
>>> G.add_nodes(3)
>>> G.add_edges([0, 0], [1, 2]) # (0, 1), (0, 2)
>>> G.successors(0)
tensor([1, 2])

See also

predecessors()