TargetIndegree
¶
Bases: BaseTransform
Saves the globally normalized in-degree of the target node of each edge
in its edge features, as PyG's TargetIndegree:
\[
\mathbf{u}(i,j) = \frac{\deg(j)}{\max_{v \in \mathcal{V}} \deg(v)}
\]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
norm
|
bool
|
Whether to normalize the degrees. Default: |
True
|
max_value
|
Optional[float]
|
The value to divide the degrees by if |
None
|
cat
|
bool
|
If |
True
|
Example:
graph = GraphData(edge_index=mx.array([[0, 1, 2], [1, 2, 1]]))
graph = TargetIndegree()(graph)
graph.edge_features
# mx.array([[1.0], [0.5], [1.0]])
Methods:
| Name | Description |
|---|---|
process |
Adds the target in-degrees to the edge features of |
Source code in mlx_graphs/transforms/degree.py
process
¶
Adds the target in-degrees to the edge features of data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
GraphData
|
The graph to transform. |
required |
Returns:
| Type | Description |
|---|---|
GraphData
|
The graph with the updated |
Source code in mlx_graphs/transforms/degree.py
from mlx_graphs.transforms import TargetIndegree · mlx_graphs/transforms/degree.py