def degree_centrality(G):
    if (len(G) <= 1):
        return {n: 1 for n in G}
    s = (1.0 / (len(G) - 1.0))
    centrality = {n: (d * s) for (n, d) in G.degree()}
    return centrality
def degree_centrality(G):
    if (len(G) <= 1):
        return {n: 1 for n in G}
    s = (1.0 / (len(G) - 1.0))
    centrality = {n: (d * s) for (n, d) in G.degree()}
    return centrality