I\'ve achieved the following plot with a combination networkx and graphviz:
I\'m very happy with the result. In the plot you can identify what I call aggreg
Ok, so I've partially solved the second question: how to plot from the aggregation nodes onwards. To do so I estimate the number of hops towards the latest one. After that I decide to label the nodes below the threshold.
def getHopToNH(nodes):
path = []
labelList = {}
for startNode in G.nodes():
endNode = 'myLabel'
try:
p = len(nx.shortest_path(G,source=startNode,target=endNode))
except:
p = -1
path.append((startNode,p))
if p < 8:
labelList = {**labelList,**{str(startNode):str(startNode)}}
else:
labelList = {**labelList,**{str(startNode):''}}
return labelList
UPDATE:
Now, in order to re-position the labels, I had to modify the position myself.
for p in pos:
yOffSet = -300
xOffSet = -400
pos[p] = (pos[p][0]+xOffSet,pos[p][1]+yOffSet)
labelDescr = nx.draw_networkx_labels(G,
pos = pos,
labels = nodeLabelDict,
font_size = nodeFontSize,)
for n,t in labelDescr.items():
finDegree = 70
t.set_rotation(finDegree)
After this, I get to plot the following:
And I really like this output now ... :-)