hierarchical coloring of nodes

Hi,
I am trying to plot a graph and color nodes in a loop. So far, the for-loop I am using can color them. But, I am able to color them using a single color. I want to color the nodes differently for each iteration of the for-loop. How do I do that?

My code so far:

···

============================================

nx.draw(G,pos, node_color='w', edge_color='k',
        width=0.5,with_labels=True,alpha=0.8)
time.sleep(1)

# Now, begin updating by coloring nodes and edges
for i,nlist in enumerate(MIS_levels):
    # update-color each level nodes
    nx.draw_networkx_nodes(G,pos,nodelist=nlist,
                           node_color='b',node_size=200,alpha=0.8)
    time.sleep(1)

    if i < len(elist):
        nx.draw_networkx_edges(G,pos, edgelist=elist[i],edge_color='r',
                               width=2,with_labels=True,alpha=0.8)

    plt.plot()
    time.sleep(1)

========================================================

The above code colors the nodes blue and the edges r. I want to options:

1 — For each iteration, I want the nodes to be colored in diminishing shade (like Red_r).
2 — For each iteration, I want a separate coloring of the nodes.

Any ideas, suggestions are very much appreicated.

Thanks,
Sri.

1/10/09 @ 12:21 (-0500), thus spake Srivathsan Srinivas:

Hi,
   I am trying to plot a graph and color nodes in a loop. So far, the
for-loop I am using can color them. But, I am able to color them using a
single color. I want to color the nodes differently for each iteration of
the for-loop. How do I do that?

Say you use matplotlib.cm.Reds_r, then you call Reds_r(N) at
each iteration, where N is an integer that increases at each
iteration. Reds_r(N) returns a colour specification that then
you pass to the plotting function as a 'color' argument.

The above code colors the nodes blue and the edges r. I want to options:

1 --- For each iteration, I want the nodes to be colored in diminishing

2 --- For each iteration, I want a separate coloring of the nodes.

For separate colouring of the nodes, you need to draw each
node separatedly as far as I know.

···

--
Ernest