remove_self_loops
¶
remove_self_loops(
edge_index: array, edge_features: array
) -> tuple[array, array]
remove_self_loops(
edge_index: array, edge_features: Optional[array] = None
) -> Union[array, tuple[array, array]]
Removes self-loops from the given graph represented by edge_index and edge_features.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge_index
|
array
|
a [2, num_edges] array representing the source and target nodes of each edge |
required |
edge_features
|
Optional[array]
|
Optional tensor representing features associated with each edge, with shape [num_edges, num_edge_features] |
None
|
Returns:
| Type | Description |
|---|---|
Union[array, tuple[array, array]]
|
A tuple containing the updated edge_index and edge_features without self-loops. |
Source code in mlx_graphs/utils/transformations.py
from mlx_graphs.utils.transformations import remove_self_loops · mlx_graphs/utils/transformations.py