def _hx(self, other):
        """Get the row diference average between two BabylonNode.

        parameters:
            [BabylonNode] other -- The other node.
        """
        total_cost = 0

        for i in range(self.rows):
            row_cost = 0
            row1 = self.grid[i]
            row2 = other.grid[i]

            for idx1 in range(self.cols):
                row3 = row2  # if row1[idx1] in row2 else other._nearest_row(i, row1[idx1])
                try:
                    idx2 = util._find(row3, row1[idx1], idx1)
                    if idx1 + idx2 == self.cols:
                        row_cost += abs(idx1 - idx2)
                    else:
                        row_cost += min(abs(idx1 - idx2), abs(self.cols - idx1 - idx2))
                except ValueError:
                    row_cost += (self.cols * self.rows)

            total_cost += (row_cost / float(self.cols))

        return total_cost
    def _hy(self, other):
        """Get the column diference average between two BabylonNode.

        parameters:
            [BabylonNode] other -- The other node.
        """
        total_cost = 0

        for i in range(self.cols):
            col_cost = 0
            row1 = [self.grid[j][i] for j in range(self.rows)]
            row2 = [other.grid[j][i] for j in range(other.rows)]

            for idx1 in range(self.rows):
                row3 = row2  # if row1[idx1] in row2 else other._nearest_col(i, row1[idx1])
                try:
                    idx2 = util._find(row3, row1[idx1], idx1)
                    col_cost += abs(idx1 - idx2)
                except ValueError:
                    col_cost += (self.cols * self.rows)

            total_cost += (col_cost / float(self.rows))

        return total_cost