Ответ 1
От Bula комментировать решение довольно легко
Трюк заключается в том, чтобы установить метки в словаре, где ключ является именем node, а значение - требуемой меткой. Поэтому для обозначения только концентраторов код будет примерно таким:
labels = {}
for node in G.nodes():
if node in hubs:
#set the node name as the key and the label as its value
labels[node] = node
#set the argument 'with labels' to False so you have unlabeled graph
nx.draw(G, with_labels=False)
#Now only add labels to the nodes you require (the hubs in my case)
nx.draw_networkx_labels(G,pos,labels,font_size=16,font_color='r')
Я получил то, что хотел, следующее:
Надеюсь, это поможет другим новичкам python/networkx, таким как я:)
Снова, спасибо Буле