Sampling subset of nodes and all neighbors

Hi Community,

I have a question regarding node sampling. Let’s say I have a graph of 1000 nodes with ID [0, 999] and the graph is fully connected, i.e. every node has connections to all other nodes. I only want to run regression on first 500 of them, i.e. ID [0,499], but I want neighborhood message be propagated from all nodes to the first 500 nodes.

I wonder if the following setup would work. Would the NeighborSampler be smart enough to sample neighbors of the second 500 nodes as neighbors? Thanks for help!

    indices=batched_graph.nodes()[0:500],  # The node IDs to iterate over in minibatches
    graph_sampler=NeighborSampler(........),  # The neighbor sampler

Yes, it will :smiley:. But if you want to get messages from all neighbors, please set -1 for fanouts parameter in NeighborSampler, otherwise only fixed number of edges will be included.