Skip to content

Commit

Permalink
fix: fix docstring for induced_subgraph
Browse files Browse the repository at this point in the history
  • Loading branch information
askorupka committed Oct 11, 2024
1 parent 93b18d4 commit ed513dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion GNNGraphs/src/sampling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function sample_neighbors(g::GNNGraph{<:COO_T}, nodes, K = -1;
end

"""
Graphs.induced_subgraph(graph::GNNGraph, nodes::Vector{Int}) -> GNNGraph
Graphs.induced_subgraph(graph::GNNGraph, nodes::Vector{Int})
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.
Expand Down
9 changes: 9 additions & 0 deletions GNNGraphs/test/sampling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ if GRAPH_T == :coo
nodes = [1, 2, 3]
subgraph = Graphs.induced_subgraph(graph, nodes)

@test subgraph.num_nodes == 3
@test subgraph.num_edges == 2
@test subgraph.ndata.x == graph.ndata.x
@test subgraph.ndata.y == graph.ndata.y
@test subgraph.edata == graph.edata

nodes = [1, 2]
subgraph = Graphs.induced_subgraph(graph, nodes)

@test subgraph.num_nodes == 3
@test subgraph.num_edges == 2
@test subgraph.ndata.x == graph.ndata.x
Expand Down

0 comments on commit ed513dc

Please sign in to comment.