def get_node_attributes(G, name):
    return {n: d[name] for n, d in G.node.items() if name in d}
Get node attributes from graph
dataset/ETHPy150Open networkx/networkx/networkx/classes/function.py/get_node_attributes