dymad.utils.graph¶
Functions
|
Convert dense adjacency matrix to edge index and edge weights. |
- dymad.utils.graph.adj_to_edge(adj)¶
Convert dense adjacency matrix to edge index and edge weights.
The inputs can be an arbitrary (nested) list or array of adjacency matrices, The outputs will be lists of edge indices and edge weights of the same hierarchy.
dense_to_sparse is not directly used, because it aggregates all graphs into one big graph. But in our framework, we want to keep them separate.
Lastly, edge_index is transposed to shape (num_edges, 2) for downstream graph-series adapters.
- Return type:
tuple[list[list[Tensor]] |list[Tensor] |Tensor|list[list[ndarray]] |list[ndarray] |ndarray,list[list[Tensor]] |list[Tensor] |Tensor|list[list[ndarray]] |list[ndarray] |ndarray]