-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* CI from GNNGraphs.jl * cleanup * fix perturb_edges * fix spelling * import * fix runtest * fix * workflow
- Loading branch information
1 parent
a590094
commit 1823e0d
Showing
10 changed files
with
172 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: GNNGraphs | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
test: | ||
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
version: | ||
- '1.10' # Replace this with the minimum Julia version that your package supports. | ||
- '1' # '1' will automatically expand to the latest stable 1.x release of Julia. | ||
# - 'pre' | ||
os: | ||
- ubuntu-latest | ||
arch: | ||
- x64 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: julia-actions/setup-julia@v2 | ||
with: | ||
version: ${{ matrix.version }} | ||
arch: ${{ matrix.arch }} | ||
- uses: julia-actions/cache@v2 | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- name: Install Julia dependencies and run tests | ||
shell: julia --project=monorepo {0} | ||
run: | | ||
using Pkg | ||
# dev mono repo versions | ||
pkg"registry up" | ||
Pkg.update() | ||
pkg"dev ./GNNGraphs" | ||
Pkg.test("GNNGraphs"; coverage=true) | ||
- uses: julia-actions/julia-processcoverage@v1 | ||
with: | ||
# directories: ./GNNGraphs/src, ./GNNGraphs/ext | ||
directories: ./GNNGraphs/src | ||
- uses: codecov/codecov-action@v4 | ||
with: | ||
files: lcov.info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,48 @@ | ||
@testset "sample_neighbors" begin | ||
# replace = false | ||
dir = :in | ||
nodes = 2:3 | ||
g = rand_graph(10, 40, bidirected = false, graph_type = GRAPH_T) | ||
sg = sample_neighbors(g, nodes; dir) | ||
@test sg.num_nodes == 10 | ||
@test sg.num_edges == sum(degree(g, i; dir) for i in nodes) | ||
@test size(sg.edata.EID) == (sg.num_edges,) | ||
@test length(union(sg.edata.EID)) == length(sg.edata.EID) | ||
adjlist = adjacency_list(g; dir) | ||
s, t = edge_index(sg) | ||
@test all(t .∈ Ref(nodes)) | ||
for i in nodes | ||
@test sort(neighbors(sg, i; dir)) == sort(neighbors(g, i; dir)) | ||
end | ||
if GRAPH_T == :coo | ||
@testset "sample_neighbors" begin | ||
# replace = false | ||
dir = :in | ||
nodes = 2:3 | ||
g = rand_graph(10, 40, bidirected = false, graph_type = GRAPH_T) | ||
sg = sample_neighbors(g, nodes; dir) | ||
@test sg.num_nodes == 10 | ||
@test sg.num_edges == sum(degree(g, i; dir) for i in nodes) | ||
@test size(sg.edata.EID) == (sg.num_edges,) | ||
@test length(union(sg.edata.EID)) == length(sg.edata.EID) | ||
adjlist = adjacency_list(g; dir) | ||
s, t = edge_index(sg) | ||
@test all(t .∈ Ref(nodes)) | ||
for i in nodes | ||
@test sort(neighbors(sg, i; dir)) == sort(neighbors(g, i; dir)) | ||
end | ||
|
||
# replace = true | ||
dir = :out | ||
nodes = 2:3 | ||
K = 2 | ||
g = rand_graph(10, 40, bidirected = false, graph_type = GRAPH_T) | ||
sg = sample_neighbors(g, nodes, K; dir, replace = true) | ||
@test sg.num_nodes == 10 | ||
@test sg.num_edges == sum(K for i in nodes) | ||
@test size(sg.edata.EID) == (sg.num_edges,) | ||
adjlist = adjacency_list(g; dir) | ||
s, t = edge_index(sg) | ||
@test all(s .∈ Ref(nodes)) | ||
for i in nodes | ||
@test issubset(neighbors(sg, i; dir), adjlist[i]) | ||
end | ||
# replace = true | ||
dir = :out | ||
nodes = 2:3 | ||
K = 2 | ||
g = rand_graph(10, 40, bidirected = false, graph_type = GRAPH_T) | ||
sg = sample_neighbors(g, nodes, K; dir, replace = true) | ||
@test sg.num_nodes == 10 | ||
@test sg.num_edges == sum(K for i in nodes) | ||
@test size(sg.edata.EID) == (sg.num_edges,) | ||
adjlist = adjacency_list(g; dir) | ||
s, t = edge_index(sg) | ||
@test all(s .∈ Ref(nodes)) | ||
for i in nodes | ||
@test issubset(neighbors(sg, i; dir), adjlist[i]) | ||
end | ||
|
||
# dropnodes = true | ||
dir = :in | ||
nodes = 2:3 | ||
g = rand_graph(10, 40, bidirected = false, graph_type = GRAPH_T) | ||
g = GNNGraph(g, ndata = (x1 = rand(10),), edata = (e1 = rand(40),)) | ||
sg = sample_neighbors(g, nodes; dir, dropnodes = true) | ||
@test sg.num_edges == sum(degree(g, i; dir) for i in nodes) | ||
@test size(sg.edata.EID) == (sg.num_edges,) | ||
@test size(sg.ndata.NID) == (sg.num_nodes,) | ||
@test sg.edata.e1 == g.edata.e1[sg.edata.EID] | ||
@test sg.ndata.x1 == g.ndata.x1[sg.ndata.NID] | ||
@test length(union(sg.ndata.NID)) == length(sg.ndata.NID) | ||
end | ||
# dropnodes = true | ||
dir = :in | ||
nodes = 2:3 | ||
g = rand_graph(10, 40, bidirected = false, graph_type = GRAPH_T) | ||
g = GNNGraph(g, ndata = (x1 = rand(10),), edata = (e1 = rand(40),)) | ||
sg = sample_neighbors(g, nodes; dir, dropnodes = true) | ||
@test sg.num_edges == sum(degree(g, i; dir) for i in nodes) | ||
@test size(sg.edata.EID) == (sg.num_edges,) | ||
@test size(sg.ndata.NID) == (sg.num_nodes,) | ||
@test sg.edata.e1 == g.edata.e1[sg.edata.EID] | ||
@test sg.ndata.x1 == g.ndata.x1[sg.ndata.NID] | ||
@test length(union(sg.ndata.NID)) == length(sg.ndata.NID) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters