def update_weights(G, weights_dict):
    W = nx.DiGraph()
for m in G.nodes():
    for n in G[m].keys():
        relation = G[m][n]['rel']
weight = weights_dict[relation]
W.add_edge(m, n, rel=weights_dict[relation])
Эффективное перечисление всех простых путей DiGraph в networkx