def create_from_edges(
    sparse_fmt,
    arrays,
    utype,
    etype,
    vtype,
    urange,
    vrange,
    row_sorted=False,
    col_sorted=False,
):
    """Internal function to create a graph from incident nodes with types.

    utype could be equal to vtype

    Parameters
    ----------
    sparse_fmt : str
        The sparse adjacency matrix format.
    arrays : tuple[Tensor]
        The sparse adjacency matrix arrays.
    utype : str
        Source node type name.
    etype : str
        Edge type name.
    vtype : str
        Destination node type name.
    urange : int, optional
        The source node ID range. If None, the value is the maximum
        of the source node IDs in the edge list plus 1. (Default: None)
    vrange : int, optional
        The destination node ID range. If None, the value is the
        maximum of the destination node IDs in the edge list plus 1. (Default: None)
    row_sorted : bool, optional
        Whether or not the rows of the COO are in ascending order.
    col_sorted : bool, optional
        Whether or not the columns of the COO are in ascending order within
        each row. This only has an effect when ``row_sorted`` is True.


    Returns
    -------
    DGLGraph
    """
    if utype == vtype:
        num_ntypes = 1
    else:
        num_ntypes = 2

    if sparse_fmt == "coo":
        u, v = arrays
        hgidx = heterograph_index.create_unitgraph_from_coo(
            num_ntypes,
            urange,
            vrange,
            u,
            v,
            ["coo", "csr", "csc"],
            row_sorted,
            col_sorted,
        )
    else:  # 'csr' or 'csc'
        indptr, indices, eids = arrays
        hgidx = heterograph_index.create_unitgraph_from_csr(
            num_ntypes,
            urange,
            vrange,
            indptr,
            indices,
            eids,
            ["coo", "csr", "csc"],
            sparse_fmt == "csc",
        )
    if utype == vtype:
        return DGLGraph(hgidx, [utype], [etype])
    else:
        return DGLGraph(hgidx, [utype, vtype], [etype])
Internal function to create a graph from incident nodes with types.

    utype could be equal to vtype

    Parameters
    ----------
    sparse_fmt : str
        The sparse adjacency matrix format.
    arrays : tuple[Tensor]
        The sparse adjacency matrix arrays.
    utype : str
        Source node type name.
    etype : str
        Edge type name.
    vtype : str
        Destination node type name.
    urange : int, optional
        The source node ID range. If None, the value is the maximum
        of the source node IDs in the edge list plus 1. (Default: None)
    vrange : int, optional
        The destination node ID range. If None, the value is the
        maximum of the destination node IDs in the edge list plus 1. (Default: None)
    row_sorted : bool, optional
        Whether or not the rows of the COO are in ascending order.
    col_sorted : bool, optional
        Whether or not the columns of the COO are in ascending order within
        each row. This only has an effect when ``row_sorted`` is True.


    Returns
    -------
    DGLGraph
    
python/dgl/convert.py