normalized_cut
¶
Functions:
| Name | Description |
|---|---|
normalized_cut |
Computes the normalized cut of every edge |
normalized_cut
¶
Computes the normalized cut of every edge (i, j):
w_ij * (1 / deg(i) + 1 / deg(j)), where deg is the in-degree
(number of incoming edges) of a node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge_index
|
array
|
a [2, num_edges] array representing the source and target nodes of each edge |
required |
edge_weights
|
array
|
The weight of each edge, of shape |
required |
num_nodes
|
Optional[int]
|
Number of nodes in the graph. Inferred from |
None
|
Returns:
| Type | Description |
|---|---|
array
|
The normalized cut of each edge, with the shape of |
Example:
edge_index = mx.array([[1, 1, 2, 3], [3, 3, 1, 2]])
edge_weights = mx.array([1.0, 1.0, 1.0, 1.0])
normalized_cut(edge_index, edge_weights)
# mx.array([1.5, 1.5, 2.0, 1.5])
Source code in mlx_graphs/utils/normalized_cut.py
from mlx_graphs.utils import normalized_cut · mlx_graphs/utils/normalized_cut.py