I wanna draw something like this :
The closest thing to this I could find was NetworkX Edge Colormap:
http://networkx.github.io/documentation/latest/examples/drawing/edge_colormap.html
and here is the source code:
#!/usr/bin/env python
"""
Draw a graph with matplotlib, color edges.
You must have matplotlib>=87.7 for this to work.
"""
__author__ = """Aric Hagberg (hagberg@lanl.gov)"""
try:
import matplotlib.pyplot as plt
except:
raise
import networkx as nx
G=nx.star_graph(20)
pos=nx.spring_layout(G)
colors=range(20)
nx.draw(G,pos,node_color='#A0CBE2',edge_color=colors,width=4,edge_cmap=plt.cm.Blues,with_labels=False)
plt.savefig("edge_colormap.png") # save as png
plt.show() # display
After playing around with their source code, I can't figure out how to hardcode distance of the edge circles from the centre. Right now its random.
Also how do I label the edge circles and their distance from the centre?
I know for position comes from pos=nx.spring_layout(G)
. So I looked at the spring_layout attribute and found that position can be specified by using a pos variable which is a dictionary with nodes as keys and values as a list. (https://networkx.github.io/documentation/latest/reference/generated/networkx.drawing.layout.spring_layout.html)
But even when I do the following result is random edges :
ap = {'uniwide':[55,34,1],'eduram':[34],'uniwide_webauth':[20,55,39],'uniwide_guest':[55,34],'tele9751_lab':[100],'HomeSDN':[100],'TP-LINK':[39]}
pos=nx.spring_layout(G,pos=ap)