neo4j / graph-data-science

Source code for the Neo4j Graph Data Science library of graph algorithms.
https://neo4j.com/docs/graph-data-science/current/
Other
621 stars 160 forks source link

GraphSAGE SWAG Implementation: Edge weights effect on sampling? #141

Closed seankrobinson closed 2 years ago

seankrobinson commented 2 years ago

Hello,

I recently learned that GDS's GraphSAGE implementation of edge weights is based on the SWAG architecture described by Pande et al.

The paper describes the use of these edge weights not only for increased/decreased contributions during aggregation, but also to bias the random sampling of neighboring nodes (where neighboring nodes with higher weights are more likely to be sampled).

Does GDS's implementation of SWAG include both of these uses of edge weights? Ie, can higher edge weights be used to encourage sampling of those neighboring nodes? If not, what other methods can be used to bias the random sampling towards neighboring nodes whos information is more relevant than other neighbors?

Thank you

FlorentinD commented 2 years ago

Hello Sean, happy to hear you are trying out GraphSAGE :)

yes our GraphSAGE implementation uses the weights for the sampling as well as the aggregation.

For the sampling, the weight influences the probability a node from a random walk is chosen see the WeightedNeighborhoodSampler. We do not have a sampling degree hyper-parameter yet, but I will add this as an improvement idea.