[Tutor] optimize a plot

Alan Gauld alan.gauld at btinternet.com
Tue Nov 15 18:51:03 CET 2011

On 15/11/11 14:34, lina wrote:
> Sorry for some not mature questions asked before, fixed now by:
> def PlotPathway(list1):
>      for i in range(len(list1)):
> 	    for j in range(len(list1[i])-1):
> 		    if list1[i][j] != list1[i][j+1]:
> 		        if ((int(list1[i][j]))<  43 and (int(list1[i][j-1]))<  43):
> 		            g.add_edge(list1[i][j], list1[i][j+1])
>      for i in range(43,84):
>          if g.has_node(i):
> 		    g.delete_node(i)
>      g.draw('graph4.png', prog="dot")
> just still don't get why the "if" does not work as expected.

Sorry, I haven't been following you earlier thread.
Which 'if'? There are 3 to choose from.
And how did you expect it to behave, and what is it doing that you 
didn't expect?

Alan G
Author of the Learn to Program web site

More information about the Tutor mailing list