code: def edge_homophily(graph, y):
      r"""Homophily measure from `Beyond Homophily in Graph Neural Networks:
      Current Limitations and Effective Designs
      <https://arxiv.org/abs/2006.11468>`__
  
      Mathematically it is defined as follows:
  
      .. math::
        \frac{| \{ (u,v) : (u,v) \in \mathcal{E} \wedge y_u = y_v \} | }
        {|\mathcal{E}|},
  
      where :math:`\mathcal{E}` is the set of edges, and :math:`y_u` is the class
      of node :math:`u`.
  
      Parameters
      ----------
      graph : DGLGraph
          The graph.
      y : torch.Tensor
          The node labels, which is a tensor of shape (|V|).
  
      Returns
      -------
      float
          The edge homophily ratio value.
  
      Examples
      --------
      >>> import dgl
      >>> import torch
  
      >>> graph = dgl.graph(([1, 2, 0, 4], [0, 1, 2, 3]))
      >>> y = torch.tensor([0, 0, 0, 0, 1])
      >>> dgl.edge_homophily(graph, y)
      0.75
      """
      check_pytorch()
      with graph.local_scope():
          # Handle the case where graph is of dtype int32.
          src, dst = get_long_edges(graph)
          # Compute y_v = y_u for all edges.
          edge_indicator = (y[src] == y[dst]).float()
          return edge_indicator.mean(dim=0).item()
  
imports: from .None import function, to_bidirected
label_desc: Use image node_id 4 for calling a global function with example usage: edge_homophily(graph, y) and returns: edge_indicator