#NEWLINE# def is_distance_regular( G ) : #NEWLINE# #INDENT# 'Returns True if the graph is distance regular, False otherwise.\n\n    A connected graph G is distance-regular if for any nodes x,y\n    and any integers i,j=0,1,...,d (where d is the graph\n    diameter), the number of vertices at distance i from x and\n    distance j from y depends only on i,j and the graph distance\n    between x and y, independently of the choice of x and y.\n\n    Parameters\n    ----------\n    G: Networkx graph (undirected)\n\n    Returns\n    -------\n    bool\n      True if the graph is Distance Regular, False otherwise\n\n    Examples\n    --------\n    >>> G=nx.hypercube_graph(6)\n    >>> nx.is_distance_regular(G)\n    True\n    \n    See Also\n    --------\n    intersection_array, global_parameters\n\n    Notes\n    -----\n    For undirected and simple graphs only\n\n    References\n    ----------\n    .. [1] Brouwer, A. E.; Cohen, A. M.; and Neumaier, A. \n        Distance-Regular Graphs. New York: Springer-Verlag, 1989.\n    .. [2] Weisstein, Eric W. "Distance-Regular Graph." \n        http://mathworld.wolfram.com/Distance-RegularGraph.html\n\n    ' #NEWLINE# try : #NEWLINE# #INDENT# a = intersection_array ( G ) #NEWLINE# return True #NEWLINE# #UNINDENT# except nx . NetworkXError : #NEWLINE# #INDENT# return False