I'm tring draw a graph in networkx and at the same time, calculate edge betweenness centrality of every edge, using this to set a different transparency for each edge. My code looks like this:
G = nx.gnp_random_graph(10,0.5)
options = {
'node_color':'black',
'node_size':1,
'alpha':0.2
}
edge_betweenness_centrality(G)
nx.draw(G,**options)
plt.show()
Where the first line is to generate a random graph with 10 nodes, and the edge_betweenness_centrality(G)
calculate edge betweenness of every edge.The output just like this:
the output of edge_betweenness_centrality(G)
And what I want to do is set the transparency of every edge using the above output. I can only set the unity transparency in options just like the above code 'alpha':0.2
. So,how do I achieve that?
Can someone help me? I will be very grateful!