NetworkX

Previous topic

get_node_attributes

Next topic

get_edge_attributes

set_edge_attributes

set_edge_attributes(G, name, attributes)[source]

Set edge attributes from dictionary of edge tuples and values

Parameters :

G : NetworkX Graph

name : string

Attribute name

attributes: dict :

Dictionary of attributes keyed by edge (tuple).

Examples

>>> G=nx.path_graph(3)
>>> bb=nx.edge_betweenness_centrality(G, normalized=False)
>>> nx.set_edge_attributes(G,'betweenness',bb)
>>> G[1][2]['betweenness']
2.0