code: def compute_percent_correct(data):
      """Compute the ratio of edges connecting two nodes with the same label.
  
      Args:
        data: A GraphDataset object.
  
      Returns:
        A float representing the ratio of edges among all graph edges that are
        connecting nodes with similar labels.
      """
      correct_edges = 0
      for edge in data.edges:
          if data.get_labels(edge.src) == data.get_labels(edge.tgt):
              correct_edges = correct_edges + 1
      total_edges = len(data.edges)
      return (
          float(correct_edges) / total_edges,
          correct_edges,
          total_edges,
      )
  
file_path: neural-structured-learning/research/gam/gam/data/robustness.py
imports: import logging
  from .dataset import GCNDataset
  from .dataset import GraphDataset
  import numpy
  import scipy
  from scipy.sparse import coo_matrix
label_desc: Use image node_id 1 for calling a global function with example usage: compute_percent_correct(data) and returns: unknown,  correct_edges,  total_edges