[Tutor] optimize a plot

lina lina.lastname at gmail.com
Tue Nov 15 15:34:35 CET 2011


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.



On Tue, Nov 15, 2011 at 10:19 PM, lina <lina.lastname at gmail.com> wrote:
> <snip>
>
> I have a little issue regarding this one, the updated code:
>
> 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:
>                            if(int(list1[i][j-1])) < 43:
>                                g.add_edge(list1[i][j], list1[i][j+1])
>    g.draw('graph4.png', prog="dot")
>
>
> I am confused, why this one still include the digital bigger than 43?
>


More information about the Tutor mailing list