dgl.norm_by_dst

dgl.norm_by_dst(g, etype=None)[source]

Calculate normalization coefficient per edge based on destination node degree.

Parameters:
  • g (DGLGraph) – The input graph.

  • etype (str or (str, str, str), optional) –

    The type of the edges to calculate. The allowed edge type formats are:

    • (str, str, str) for source node type, edge type and destination node type.

    • or one str edge type name if the name can uniquely identify a triplet format in the graph.

    It can be omitted if the graph has a single edge type.

Returns:

The normalization coefficient of the edges.

Return type:

1D Tensor

Examples

>>> import dgl
>>> g = dgl.graph(([0, 1, 1], [1, 1, 2]))
>>> print(dgl.norm_by_dst(g))
tensor([0.5000, 0.5000, 1.0000])