williamleif / GraphSAGE

Representation learning on large graphs using stochastic graph convolutions.
Other
3.43k stars 844 forks source link

What if the number of neighbors is less than the pre-defined number? #180

Open HenryYuen128 opened 2 years ago

HenryYuen128 commented 2 years ago

N(v) ,the fixed-size of neighbors, which is mentioned in the paper. I think this is to make sure that the aggregate function can work correctly. But what if a node with neighbors less than N(v). How dose the model sample and train? And what would happen if there is an isolated node in train or inference stage?

sam-lev commented 2 years ago

Graphsage will either be given as a parameter a max node degree to adhere to or observe the node with the highest degree and when building the adjacency matrix will sample the neighbors of each node and in the event a node has fewer neighbors than max(N(v)) then that node's neighbors will be resampled (sampled with replacement).

If a node is isolated, meaning no incident edges or neighbors, then graphsage can not aggregate to that node and an embedding can't be learned for that node.