def _even_offset(n, k):
    """Split an array of length n into k segments and the difference of thier length is
    at most 1. Return the offset of each segment.
    """
    eles_per_part = n // k
    offset = np.array([0] + [eles_per_part] * k, dtype=int)
    offset[1 : n - eles_per_part * k + 1] += 1
    return np.cumsum(offset)
Split an array of length n into k segments and the difference of thier length is
    at most 1. Return the offset of each segment.
    
python/dgl/distributed/dist_graph.py