contains_self_loops
¶
contains_self_loops(edge_index: array) -> bool
Returns True if the graph given by edge_index contains self-loops.
PyG-named alias of has_self_loops().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge_index
|
array
|
a [2, num_edges] array representing the source and target nodes of each edge |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether the graph has at least one edge |
Example:
Source code in mlx_graphs/utils/loop.py
from mlx_graphs.utils import contains_self_loops · mlx_graphs/utils/loop.py