GraphSAGE icon indicating copy to clipboard operation
GraphSAGE copied to clipboard

how sage train the node that only have 1 top neighbors?

Open banbsyip opened this issue 4 years ago • 3 comments

if a node only have 1 top neighbors,should i have to remove the node before i train the sage model? or the model just train the node only use the 1 top neighbors?

banbsyip avatar Feb 25 '22 05:02 banbsyip

I'm going to assume you mean one-hop neighbors (correct me if I'm wrong) but this may cause issues as the number of layers determines the aggregation. With graphsage one potential adaption you could make is to reduce the number of aggregation layers, in their tensorflow implementation this is defined as layers_info when the model is instantiated.

layer_infos = [SAGEInfo("node", sampler, FLAGS.samples_1, FLAGS.dim_1), SAGEInfo("node", sampler, FLAGS.samples_2, FLAGS.dim_2)]

Something you will also want to take into account is the number of neighbors being sampled per layer. You won't want to sample more than neighbors available although I think they will do re-sampling if you do. In the tensorflow implementation, this is defined as 'degree_l1,_l2, ... on line 221.

Out of curiosity, graphsage is good for inductive learning on large graphs. How dense is your graph?

sam-lev avatar Feb 28 '22 21:02 sam-lev

I misunderstood your question/problem setting. No, you don't need to remove nodes with only 1 neighbor. If the degree of a node is less than the max degree then graphsage will perform random sampling when building the adjacency matrix.

sam-lev avatar Feb 28 '22 21:02 sam-lev

I misunderstood your question/problem setting. No, you don't need to remove nodes with only 1 neighbor. If the degree of a node is less than the max degree then graphsage will perform random sampling when building the adjacency matrix.

I mean that if one node named A,the A node only have 1 degree of nodes, or the A node have no neighbor, but I set the degree to 2, how the graphsage train the A node?

banbsyip avatar Mar 01 '22 01:03 banbsyip