How to add node color as attributes using Network X

Viewed 145

How do I store NetworkX output not as .png or image files, but as an analyzable format with color as node attribute?

Below are the code used to draw NetworkX graph.

draw_networkx(
        graph,
        pos=graph.graph['positions'],
        node_color=graph.graph['colors'],
        labels=graph.graph['labels'],
        label=example_presentation,
        font_size=8,
        node_size=800
    )

graph.graph['colors'] is

['#5B9BD5',
 '#E7E6E6',
 '#ff0000',
 '#70AD47',
 '#E7E6E6',
 '#ff0000',
 '#70AD47',
 '#E7E6E6',
 '#E7E6E6',
 '#E7E6E6',
 '#E7E6E6',
 '#E7E6E6',
 '#E7E6E6']
0 Answers
Related