I have a file with lines like these (node1; node2; label-weight)
497014; 5674; 200
5674; 5831; 400
410912; 5674; 68,5
7481; 5674; 150
5831; 5674; 200
the first and the second elements in the row are nodes of a networkx graph. The third is the edge's label (or weight or lenght). I'm using python 3.4 and networkx 1.9 and I would like to plot labels near or inside the edges (it would be nice if the weight = label = thickness of the edge)
with this code, plotted edges don't have labels.
import networkx as nx
import matplotlib.pyplot as plt
data= open("C:\\Users\\User\\Desktop\\test.csv", "r")
G = nx.DiGraph()
for line in data:
(node1, node2, weight1) = (line.strip()).split(";")
G.add_edge(node1, node2, label=str(weight1),length=int(weight1))
nx.draw_networkx(G)
plt.show()
I've seen that is possible to add edges with labels using dictionaries. I'm working on that but at the moment this solution is too far from me.
Thanks.
