-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add NeighborLoader #497
base: master
Are you sure you want to change the base?
Conversation
63c6711
to
b8f23d4
Compare
Hi @CarloLucibello I just wanted to check if it's ok to add |
end | ||
end | ||
|
||
function induced_subgraph(graph::GNNGraph, nodes::Vector{Int}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a generically useful function, this should go into GNNGraphs.jl, be documented and exported, possibly in a separate PR.
Moreover, since Graphs.jl defines this interface, we should overload Graphs.induced_interface
.
Notice that we already have the very similar function sample_neighbors in GNNGraphs.jl. Let's implement induced_interface
as well in order to be Graphs.jl
compliant. At some point we could merge the two functionalities though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opened another PR #499
return backup_gnn # Return empty graph if no nodes are provided | ||
end | ||
|
||
return GNNGraph(source, target, ndata = new_features) # Return the new GNNGraph with subgraph and features |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The returned graph should inherit all the node and the edge features from the original graph.
you can get them through getobs(graph.ndata, node_ids)
and getobs(graph.edata, edge_ids)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid this is not working, I also don't see docs about this method
julia> getobs(g.ndata, 1)
ERROR: UndefVarError: `getobs` not defined
Stacktrace:
[1] top-level scope
@ REPL[8]:1
end | ||
|
||
# Extract features for the new nodes | ||
new_features = graph.x[:, nodes] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you shouldn't assume that a graph has node features named x
It is fine, |
Now dependent on & blocked by #499 |
This PR adds NeighborLoader functionality for big graphs.
This is similar to https://pytorch-geometric.readthedocs.io/en/latest/tutorial/neighbor_loader.html
PR with documentation will follow.