G = nx.DiGraph()
G.add_edge(1, 2, weight=10)
G.add_edge(2, 3, weight=20)
G[2][3]['weight']
G[2][3]['weight'] = 200
G[2][3]['weight']
G.edges(data=True)
for u, v, d in G.edges(data=True):
    d['weight'] += 7
G.edges(data=True)
NetworkX (Python): как изменить вес ребер по заданному правилу