Function returns the sum of squared differences in the expression of a gene, per cell
    :param i: int representing the index of the cell being processed 
    :param j: int representing the index of the gene being processed
    :param traj_exp: ndarray representing gene expression
    :param adj_mat: ndarray representing the calculated adjacency matrix
    :return: float representing the sum of squared differences

def dev_ij(i,j,traj_exp,adj_mat): #takes adjacency matrix and raw expression data
    '''
    Function returns the sum of squared differences in the expression of a gene, per cell
    :param i: int representing the index of the cell being processed 
    :param j: int representing the index of the gene being processed
    :param traj_exp: ndarray representing gene expression
    :param adj_mat: ndarray representing the calculated adjacency matrix
    :return: float representing the sum of squared differences
    '''
    t=np.asmatrix(traj_exp) 
    wh=np.where(adj_mat[i]>0) #looks for indices where the adjacency is greater than 0
    return np.sum(np.square(t[i,j]-t[wh,j],dtype=float),dtype=float)