ott.geometry.geodesic.Geodesic.from_graph

ott.geometry.geodesic.Geodesic.from_graph#

classmethod Geodesic.from_graph(G, t=0.001, eigval=None, order=100, directed=False, normalize=False, rng=None, **kwargs)[source]#

Construct a Geodesic geometry from an adjacency matrix.

Parameters:
  • G (Union[Array, BCOO]) – Adjacency matrix.

  • t (Optional[float]) – Time parameter for approximating the geodesic exponential kernel. If None, it defaults to \(\frac{1}{|E|} \sum_{(u, v) \in E} \text{weight}(u, v)\) [Crane et al., 2013]. In this case, the graph must be specified and the edge weights are assumed to be positive.

  • eigval (Optional[Array]) – Largest eigenvalue of the Laplacian. If None, it’s computed using jax.experimental.sparse.linalg.lobpcg_standard().

  • order (int) – Max order of Chebyshev polynomials.

  • directed (bool) – Whether the graph is directed. If True, it’s made undirected as \(G + G^T\). This parameter is ignored when passing the Laplacian directly, assumed to be symmetric.

  • normalize (bool) – Whether to normalize the Laplacian as \(L^{sym} = \left(D^+\right)^{\frac{1}{2}} L \left(D^+\right)^{\frac{1}{2}}\), where \(L\) is the non-normalized Laplacian and \(D\) is the degree matrix.

  • rng (Optional[Array]) – Random key used when computing the largest eigenvalue.

  • kwargs (Any) – Keyword arguments for Geodesic.

Return type:

Geodesic

Returns:

The Geodesic geometry.