"""
This type stub file was generated by pyright.
"""

"""Data utilities."""
def elist2tensor(elist, idtype): # -> tuple[Unknown, Unknown]:
    """Function to convert an edge list to edge tensors.

    Parameters
    ----------
    elist : iterable of int pairs
        List of (src, dst) node ID pairs.
    idtype : int32, int64, optional
        Integer ID type. Must be int32 or int64.

    Returns
    -------
    (Tensor, Tensor)
        Edge tensors.
    """
    ...

def scipy2tensor(spmat, idtype): # -> SparseAdjTuple:
    """Function to convert a scipy matrix to a sparse adjacency matrix tuple.

    Note that the data array of the scipy matrix is discarded.

    Parameters
    ----------
    spmat : scipy.sparse.spmatrix
        SciPy sparse matrix.
    idtype : int32, int64, optional
        Integer ID type. Must be int32 or int64.

    Returns
    -------
    (str, tuple[Tensor])
        A tuple containing the format as well as the list of tensors representing
        the sparse matrix.
    """
    ...

def networkx2tensor(nx_graph, idtype, edge_id_attr_name=...): # -> tuple[Unknown, Unknown]:
    """Function to convert a networkx graph to edge tensors.

    Parameters
    ----------
    nx_graph : nx.Graph
        NetworkX graph.
    idtype : int32, int64, optional
        Integer ID type. Must be int32 or int64.
    edge_id_attr_name : str, optional
        Key name for edge ids in the NetworkX graph. If not found, we
        will consider the graph not to have pre-specified edge ids. (Default: None)

    Returns
    -------
    (Tensor, Tensor)
        Edge tensors.
    """
    ...

SparseAdjTuple = ...
def graphdata2tensors(data, idtype=..., bipartite=..., **kwargs):
    """Function to convert various types of data to edge tensors and infer
    the number of nodes.

    Parameters
    ----------
    data : graph data
        Various kinds of graph data.  Possible data types are:

        - ``(row, col)``
        - ``('coo', (row, col))``
        - ``('csr', (indptr, indices, edge_ids))``
        - ``('csc', (indptr, indices, edge_ids))``
        - SciPy sparse matrix
        - NetworkX graph
    idtype : int32, int64, optional
        Integer ID type. If None, try infer from the data and if fail use
        int64.
    bipartite : bool, optional
        Whether infer number of nodes of a bipartite graph --
        num_src and num_dst can be different.
    kwargs

        - edge_id_attr_name : The name (str) of the edge attribute that stores the edge
          IDs in the NetworkX graph.
        - top_map : The dictionary mapping the original IDs of the source nodes to the
          new ones.
        - bottom_map : The dictionary mapping the original IDs of the destination nodes
          to the new ones.

    Returns
    -------
    data : SparseAdjTuple
        A tuple with the sparse matrix format and the adjacency matrix tensors.
    num_src : int
        Number of source nodes.
    num_dst : int
        Number of destination nodes.
    """
    ...

def networkxbipartite2tensors(nx_graph, idtype, top_map, bottom_map, edge_id_attr_name=...): # -> tuple[Unknown, Unknown]:
    """Function to convert a networkx bipartite to edge tensors.

    Parameters
    ----------
    nx_graph : nx.Graph
        NetworkX graph. It must follow the bipartite graph convention of networkx.
        Each node has an attribute ``bipartite`` with values 0 and 1 indicating
        which set it belongs to.
    top_map : dict
        The dictionary mapping the original node labels to the node IDs for the source type.
    bottom_map : dict
        The dictionary mapping the original node labels to the node IDs for the destination type.
    idtype : int32, int64, optional
        Integer ID type. Must be int32 or int64.
    edge_id_attr_name : str, optional
        Key name for edge ids in the NetworkX graph. If not found, we
        will consider the graph not to have pre-specified edge ids. (Default: None)

    Returns
    -------
    (Tensor, Tensor)
        Edge tensors.
    """
    ...

def infer_num_nodes(data, bipartite=...):
    """Function for inferring the number of nodes.

    Parameters
    ----------
    data : graph data
        Supported types are:

        * SparseTuple ``(sparse_fmt, arrays)`` where ``arrays`` can be either ``(src, dst)`` or
          ``(indptr, indices, data)``.
        * SciPy matrix.
        * NetworkX graph.
    bipartite : bool, optional
        Whether infer number of nodes of a bipartite graph --
        num_src and num_dst can be different.

    Returns
    -------
    num_src : int
        Number of source nodes.
    num_dst : int
        Number of destination nodes.

    or

    None
        If the inference failed.
    """
    ...

