LocalDegreeProfile
¶
Bases: BaseTransform
Appends the Local Degree Profile (LDP) from "A Simple yet Effective Baseline for Non-attribute Graph Classification" to the node features, as PyG's
LocalDegreeProfile:
where \(\deg(i)\) is the out-degree of node \(i\) and \(DN(i) = \{ \deg(j) \mid (i, j) \in \mathcal{E} \}\) holds the degrees of its neighbors. The statistics of a node without neighbors are zeros. As in PyG, the standard deviation is the population one, and values below \(\sqrt{10^{-5}}\) are set to zero.
Example:
graph = GraphData(edge_index=mx.array([[0, 1, 1, 2], [1, 0, 2, 1]]))
graph = LocalDegreeProfile()(graph)
graph.node_features
# mx.array([[1, 2, 2, 2, 0], [2, 1, 1, 1, 0], [1, 2, 2, 2, 0]])
Methods:
| Name | Description |
|---|---|
process |
Appends the local degree profile to the node features of |
process
¶
Appends the local degree profile to the node 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 LocalDegreeProfile · mlx_graphs/transforms/degree.py