diff --git a/GNNGraphs/src/sampling.jl b/GNNGraphs/src/sampling.jl index ec660692d..7e723182a 100644 --- a/GNNGraphs/src/sampling.jl +++ b/GNNGraphs/src/sampling.jl @@ -117,8 +117,9 @@ function sample_neighbors(g::GNNGraph{<:COO_T}, nodes, K = -1; return gnew end + """ - induced_subgraph(graph::GNNGraph, nodes::Vector{Int}) + induced_subgraph(graph, nodes) Generates a subgraph from the original graph using the provided `nodes`. The function includes the nodes' neighbors and creates edges between nodes that are connected in the original graph. @@ -127,12 +128,12 @@ Returns A new `GNNGraph` containing the subgraph with the specified nodes and th # Arguments -- `graph::GNNGraph`. The original graph containing nodes, edges, and node features. -- `nodes::Vector{Int}. A vector of node indices to include in the subgraph. - +- `graph`. The original GNNGraph containing nodes, edges, and node features. +- `nodes``. A vector of node indices to include in the subgraph. + # Examples -```jldoctest +```julia julia> s = [1, 2] 2-element Vector{Int64}: 1 @@ -167,6 +168,7 @@ GNNGraph: x = 32×2 Matrix{Float32} edata: e = 1-element Vector{Float32} +``` """ function Graphs.induced_subgraph(graph::GNNGraph, nodes::Vector{Int}) if isempty(nodes)