def is_distance_regular(G):
 try:
  intersection_array(G)
  return True
 except nx.NetworkXError:
  return False

def is_distance_regular ( G ) : try : intersection_array ( G ) return True except nx . NetworkXError : return False
returns true if the graph is distance regular .