(path)
return downs
0 same 1 down
0 same 1 down
0 same 1 down
def path2downs(path):
    '''
    0 same 1 down
    '''
    downs = []
    prev = path[0]
    for node in path[1:]:
        assert (node - prev) in [0, 1]
        if node > prev:
            downs.append(1)
        else:
            downs.append(0)
        prev = node
    downs.append(0)
    return downs
def path2downs ( path ) : downs = [ ] prev = path [ 0 ] for node in path [ 1 : ] : assert ( node - prev ) in [ 0 , 1 ] if node > prev : downs . append ( 1 ) else : downs . append ( 0 ) prev = node downs . append ( 0 ) return downs