def degree_histogram(G):
    """Return a list of the frequency of each degree value.

    Parameters
    ----------
    G : Networkx graph
       A graph

    Returns
    -------
    hist : list
       A list of frequencies of degrees.
       The degree values are the index in the list.

    Notes
    -----
    Note: the bins are width one, hence len(list) can be large
    (Order(number_of_edges))
    """
    degseq = list(G.degree().values())
    dmax = max(degseq) + 1
    freq = [(0) for d in range(dmax)]
    for d in degseq:
        freq[d] += 1
    return freq
