def get_gid_offsets(typenames, typecounts):
    """
    Builds a map where the key-value pairs are typnames and respective
    global-id offsets.

    Parameters:
    -----------
    typenames : list of strings
        a list of strings which can be either node typenames or edge typenames
    typecounts : list of integers
        a list of integers indicating the total number of nodes/edges for its
        typeid which is the index in this list

    Returns:
    --------
    dictionary :
        a dictionary where keys are node_type names and values are
        global_nid range, which is a tuple.

    """
    assert len(typenames) == len(
        typecounts
    ), f"No. of typenames does not match with its type counts names = {typenames}, counts = {typecounts}"

    counts = []
    for name in typenames:
        counts.append(typecounts[name])
    starts = np.cumsum([0] + counts[:-1])
    ends = np.cumsum(counts)

    gid_offsets = {}
    for idx, name in enumerate(typenames):
        gid_offsets[name] = [starts[idx], ends[idx]]
    return gid_offsets

    """
    starts = np.cumsum([0] + type_counts[:-1])
    ends = np.cumsum(type_counts)
    gid_offsets = {}
    for idx, name in enumerate(typenames):
        gid_offsets[name] = [start[idx], ends[idx]]

    return gid_offsets
    """

    Builds a map where the key-value pairs are typnames and respective
    global-id offsets.

    Parameters:
    -----------
    typenames : list of strings
        a list of strings which can be either node typenames or edge typenames
    typecounts : list of integers
        a list of integers indicating the total number of nodes/edges for its
        typeid which is the index in this list

    Returns:
    --------
    dictionary :
        a dictionary where keys are node_type names and values are
        global_nid range, which is a tuple.

    
tools/distpartitioning/utils.py