NetworkX

Previous topic

networkx.classes.function.edges_iter

Next topic

networkx.classes.function.get_node_attributes

networkx.classes.function.set_node_attributes

networkx.classes.function.set_node_attributes(G, name, attributes)

Set node attributes from dictionary of nodes and values

Parameters :

G : NetworkX Graph

name : string

Attribute name

attributes: dict :

Dictionary of attributes keyed by node.

Examples

>>> G=nx.path_graph(3)
>>> bb=nx.betweenness_centrality(G)
>>> nx.set_node_attributes(G,'betweenness',bb)
>>> G.node[1]['betweenness']
1.0