mlx_graphs.utils.transformations.to_undirected

Contents

mlx_graphs.utils.transformations.to_undirected#

mlx_graphs.utils.transformations.to_undirected(edge_index: mlx.core.array, edge_features: mlx.core.array | None = None) mlx.core.array | tuple[mlx.core.array, mlx.core.array][source]#

Converts a graph given as edge_index and, optionally, edge_features to an undirected one.

Parameters:
  • edge_index (array) – The edge index of the graph.

  • edge_features (Optional[array]) – Edge features associated with each edge.

Return type:

Union[array, tuple[array, array]]

Returns:

The undirected edge_index (and edge_features)