def _convert_dgl_partition_to_gb(
    ntypes,
    etypes,
    gpb,
    part_meta,
    graph,
    graph_formats=None,
    store_eids=False,
    store_inner_node=False,
    store_inner_edge=False,
):
    """Converts a single DGL partition to GraphBolt.

    Parameters
    ----------
    node types : dict
        The node types
    edge types : dict
        The edge types
    gpb : GraphPartitionBook
        The global partition information.
    part_meta : dict
        Contain the meta data of the partition.
    graph : DGLGraph
        The graph to be converted to graphbolt graph.
    graph_formats : str or list[str], optional
        Save partitions in specified formats. It could be any combination of
        `coo`, `csc`. As `csc` format is mandatory for `FusedCSCSamplingGraph`,
        it is not necessary to specify this argument. It's mainly for
        specifying `coo` format to save edge ID mapping and destination node
        IDs. If not specified, whether to save `coo` format is determined by
        the availability of the format in DGL partitions. Default: None.
    store_eids : bool, optional
        Whether to store edge IDs in the new graph. Default: True.
    store_inner_node : bool, optional
        Whether to store inner node mask in the new graph. Default: False.
    store_inner_edge : bool, optional
        Whether to store inner edge mask in the new graph. Default: False.
    """
    debug_mode = "DGL_DIST_DEBUG" in os.environ
    if debug_mode:
        dgl_warning(
            "Running in debug mode which means all attributes of DGL partitions"
            " will be saved to the new format."
        )
    num_parts = part_meta["num_parts"]

    is_homo = is_homogeneous(ntypes, etypes)
    node_type_to_id = (
        None if is_homo else {ntype: ntid for ntid, ntype in enumerate(ntypes)}
    )
    edge_type_to_id = (
        None
        if is_homo
        else {
            gb.etype_tuple_to_str(etype): etid for etype, etid in etypes.items()
        }
    )
    # Obtain CSC indtpr and indices.
    indptr, indices, edge_ids = graph.adj_tensors("csc")

    node_attributes, edge_attributes, type_per_edge = _create_attributes_gb(
        graph,
        gpb,
        edge_ids,
        is_homo,
        store_inner_node,
        store_inner_edge,
        store_eids,
        debug_mode,
    )
    # When converting DGLGraph to FusedCSCSamplingGraph, edge IDs are
    # re-ordered(actually FusedCSCSamplingGraph does not have edge IDs
    # in nature). So we need to save such re-order info for any
    # operations that uses original local edge IDs. For now, this is
    # required by `DistGraph.find_edges()` for link prediction tasks.
    #
    # What's more, in order to find the dst nodes efficiently, we save
    # dst nodes directly in the edge attributes.
    #
    # So we require additional `(2 * E) * dtype` space in total.
    if graph_formats is not None and isinstance(graph_formats, str):
        graph_formats = [graph_formats]
    save_coo = (
        graph_formats is None and "coo" in graph.formats()["created"]
    ) or (graph_formats is not None and "coo" in graph_formats)
    if save_coo:
        edge_attributes[DGL2GB_EID] = torch.argsort(edge_ids)
        edge_attributes[GB_DST_ID] = gb.expand_indptr(
            indptr, dtype=indices.dtype
        )

    indptr, indices, type_per_edge = cast_various_to_minimum_dtype_gb(
        graph=graph,
        part_meta=part_meta,
        num_parts=num_parts,
        indptr=indptr,
        indices=indices,
        type_per_edge=type_per_edge,
        etypes=etypes,
        ntypes=ntypes,
        node_attributes=node_attributes,
        edge_attributes=edge_attributes,
    )

    csc_graph = gb.fused_csc_sampling_graph(
        indptr,
        indices,
        node_type_offset=None,
        type_per_edge=type_per_edge,
        node_attributes=node_attributes,
        edge_attributes=edge_attributes,
        node_type_to_id=node_type_to_id,
        edge_type_to_id=edge_type_to_id,
    )
    return csc_graph
Converts a single DGL partition to GraphBolt.

    Parameters
    ----------
    node types : dict
        The node types
    edge types : dict
        The edge types
    gpb : GraphPartitionBook
        The global partition information.
    part_meta : dict
        Contain the meta data of the partition.
    graph : DGLGraph
        The graph to be converted to graphbolt graph.
    graph_formats : str or list[str], optional
        Save partitions in specified formats. It could be any combination of
        `coo`, `csc`. As `csc` format is mandatory for `FusedCSCSamplingGraph`,
        it is not necessary to specify this argument. It's mainly for
        specifying `coo` format to save edge ID mapping and destination node
        IDs. If not specified, whether to save `coo` format is determined by
        the availability of the format in DGL partitions. Default: None.
    store_eids : bool, optional
        Whether to store edge IDs in the new graph. Default: True.
    store_inner_node : bool, optional
        Whether to store inner node mask in the new graph. Default: False.
    store_inner_edge : bool, optional
        Whether to store inner edge mask in the new graph. Default: False.
    
python/dgl/distributed/partition.py