Skip to content
Graph Intelligence Hub
Menu

Algorithm

Graph Convolutional Network (GCN)

activeNeeds verification

Neural network layer that updates each node from a degree-normalised average of its neighbours' features, trained end-to-end for semi-supervised node classification.

Definition

Intuition

Each layer smooths features over one hop of neighbours, then applies a learned linear map and nonlinearity; k layers see k hops.

Complexity

TimeO(E · d) per layer (sparse)
SpaceO(V · d + E)

Python

import torch.nn.functional as F
from torch_geometric.nn import GCNConv
class GCN(torch.nn.Module):
    def __init__(self, i, h, o):
        super().__init__(); self.c1 = GCNConv(i, h); self.c2 = GCNConv(h, o)
    def forward(self, x, ei):
        return self.c2(F.relu(self.c1(x, ei)), ei)

An interactive step-by-step visualizer for this algorithm is planned for phase 3.

Profile

Time complexityO(E · d) per layer (sparse)
Space complexityO(V · d + E)

Relationships

Prerequisite of
Prerequisites
Implemented by
Related