I\'m trying to improve the speed of this function in Cython, because is the main function of an algorithm.
cpdef float _cost(list path, int lenth, dict time, dict