OTProblem.set_graph_xy(data, cost='geodesic', t=None)[source]#

Set a graph for the linear term for graph based distances.

  • data (Union[DataFrame, Tuple[csr_matrix, Series, Series]]) –

    Data containing the graph.

    • If of type DataFrame, its index must be equal to adata_src.obs_names and its columns to adata_tgt.obs_names.

    • If of type tuple, it must be of the form (sp.csr_matrix, pd.Series, pd.Series), where the first element is the graph, the second element and the third element are the annotations of the graph.

  • cost (Literal['geodesic']) – Which graph-based distance to use.

  • t (Optional[float]) – Time parameter at which to solve the heat equation, see [Crane et al., 2013]. When t is None, t will be set to \(\epsilon / 4\), where \(\epsilon\) is the entropy regularization term. This approaches the geodesic distance and allows for linear memory complexity as the cost matrix does not have to be instantiated [Huguet et al., 2023].

Return type:



: Nothing, just updates the following fields: