ott.geometry.graph.Graph.from_graph

ott.geometry.graph.Graph.from_graph#

classmethod Graph.from_graph(G, t=0.001, directed=False, normalize=False, **kwargs)[source]#

Construct Graph from an adjacency matrix.

Parameters:
  • G (Array) – Adjacency matrix.

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

  • directed (bool) – Whether the graph is directed. If not, it will be made undirected as \(G + G^T\). This parameter is ignored when directly passing the Laplacian, which is 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.

  • kwargs (Any) – Keyword arguments for Graph.

Return type:

Graph

Returns:

The graph geometry.