can anyone give me a hint on the following code?<br><br>import network as nx<br>import pylab as plt<br><br>G=nx.Graph(M)  # M is numpy matrix ,i.e:type(M)=numpy.ndarray<br>for i in xrange(len(M)): <br>      tt=P[i,:].sum()<br>
      if tt==1:<br>          G.add_node(i,color='blue')    <br>      elif tt==2:<br>          G.add_node(i,color='red')<br>      elif tt==3:<br>          G.add_node(i,color='white')<br>      else:<br>
          tt==4<br>          G.add_node(i,color='green')<br>G.nodes(data=True)<br>T=nx.draw(G)<br>plt.axis('off')<br>plt.savefig("test.png")<br><br>I didn't get color change, still the defualt color is used.Did I miss something?<br>
<br>my aim is to obtain:<br>something like:<br>find total number of w-red-red-z path<br>           number of w-red-red-red-z path<br>           number of w-red-red-red-red-z path<br>where w (left side of some cyclic polygon(can also be conjugated ring))<br>
and z(right-side of it)are any of the colors except red.<br><br>any comment is appreciated?<br>Thanks<br>Bob<br>