Can't Set Weight For Graph With Networkx
Can't set weight for edges in graph. My dataset dict_value={'Источник':[10301.0,10301.0,10301.0,10301.0,10329.0,10332.0,10333.0,10334.0,174143.0,1030408.0,10306066.0],
Solution 1:
If you want to change edge thickness, add penwidth
to your arguments
G = nx.MultiDiGraph()
for row in session_graph.itertuples():
if row[4]==1:
G.add_edge(row[1], row[2],label=row[3],color="green",weight=0.9, penwidth = 5)
if row[4]==9:
G.add_edge(row[1], row[2],label=row[3],color="red",weight=0.4, penwidth = 1)
If you draw your graph in dot
format with you will see, that the problem is in GraphViz - it ignores weight argument but works with penwidth
parameter, so you need to pass it to the drawing library.
See Graphviz, changing the size of edge question for details.
Post a Comment for "Can't Set Weight For Graph With Networkx"