mlx_graphs.utils.transformations.to_adjacency_matrix#
- mlx_graphs.utils.transformations.to_adjacency_matrix(edge_index: mlx.core.array, edge_features: mlx.core.array | None = None, num_nodes: int | None = None) mlx.core.array [source]#
Converts an edge index representation to an adjacency matrix.
- Parameters:
edge_index (
array
) – a [2, num_edges] array representing the source and target nodes of each edgeedge_features (
Optional
[array
]) – a 1-dimensional array representing the features corresponding to the edges in edge_index. Defaults to None.num_nodes (
Optional
[int
]) – the number of nodes in the graph. Defaults to the number of nodes in edge_index
- Return type:
- Returns:
The resulting adjacency matrix