Implementing a Graph Neural Network (GNN) Layer
Implement a simple Graph Neural Network (GNN) layer for node classification on a small graph. The layer should aggregate features from a node's neighbors and combine them with the node's own features. A simple aggregation could be a mean or sum of neighbor features. You'll need to represent the graph using an adjacency matrix or an edge list. You can use torch-geometric
as a starting point, but the core logic should be implemented from scratch.
Verification: Test the layer with a small, manually defined graph. The output node embeddings should reflect the influence of their neighbors, for instance, nodes in the same cluster should have similar embeddings.