Skip to content Skip to sidebar Skip to footer

Networkx Node Sizes

I am creating a networkX graph with the node sizes correlating to nodes. When I create the graph, the node sizes don't correspond correctly with the size list passed to the graph.

Solution 1:

networkx stores nodes in a dict. When it draws them, it basically looks at the keys in the order python gives. There's no guarantee that's the same order that you've put their weights into sizes.

So try:

nx.draw_networkx(G,pos,nodelist = nodelist, node_size=sizes)

Post a Comment for "Networkx Node Sizes"