Skip to content

Commit 5b5663e

Browse files
include all docs (#535)
1 parent ca90e88 commit 5b5663e

File tree

19 files changed

+175
-162
lines changed

19 files changed

+175
-162
lines changed

.github/workflows/multidocs.yml

Lines changed: 24 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,81 +20,63 @@ jobs:
2020
- name: Set up
2121
run: git config --global init.defaultBranch master
2222

23-
# Build GNNGraphs docs
24-
- name: Install dependencies for GNNGraphs
23+
- name: Build GNNGraphs docs
2524
run:
2625
julia --project=GNNGraphs/docs/ -e '
2726
using Pkg;
28-
Pkg.develop(PackageSpec(path=joinpath(pwd(), "GNNGraphs")));
29-
Pkg.instantiate();'
30-
- name: Build GNNGraphs docs
27+
pkg"dev ./GNNGraphs";
28+
Pkg.instantiate();
29+
include("GNNGraphs/docs/make.jl")'
3130
env:
3231
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
3332
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
34-
run: julia --project=GNNGraphs/docs/ GNNGraphs/docs/make.jl
3533

36-
# Build GNNlib docs
37-
- name: Install dependencies for GNNlib
38-
run: julia --project=GNNlib/docs/ -e 'using Pkg; Pkg.instantiate();'
3934
- name: Build GNNlib docs
35+
run: julia --project=GNNlib/docs/ -e '
36+
using Pkg;
37+
pkg"dev ./GNNlib ./GNNGraphs";
38+
Pkg.instantiate();
39+
include("GNNlib/docs/make.jl")'
4040
env:
4141
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
4242
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
43-
run: julia --project=GNNlib/docs/ GNNlib/docs/make.jl
4443

45-
# Build GNNLux docs
46-
- name: Install dependencies for GNNLux
44+
- name: Build GNNLux docs
4745
run: julia --project=GNNLux/docs/ -e '
4846
using Pkg;
49-
Pkg.develop(PackageSpec(path=joinpath(pwd(), "GNNLux")));
50-
Pkg.instantiate();'
51-
- name: Build GNNLux docs
47+
pkg"dev ./GNNLux ./GNNlib ./GNNGraphs";
48+
Pkg.instantiate();
49+
include("GNNLux/docs/make.jl")'
5250
env:
5351
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
5452
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
55-
run: julia --project=GNNLux/docs/ GNNLux/docs/make.jl
5653

57-
# Build GraphNeuralNetworks docs
58-
- name: Install dependencies for GraphNeuralNetworks
59-
run: julia --project=GraphNeuralNetworks/docs/ -e '
60-
using Pkg;
61-
Pkg.develop(PackageSpec(path=joinpath(pwd(), "GraphNeuralNetworks")));
62-
Pkg.instantiate();'
6354
- name: Build GraphNeuralNetworks docs
64-
env:
65-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
66-
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
67-
run: julia --project=GraphNeuralNetworks/docs/ GraphNeuralNetworks/docs/make.jl
68-
69-
# Build multidocs
70-
- name: Install dependencies for main docs
71-
run: julia --project=GraphNeuralNetworks/docs/ -e '
55+
run: julia --project=GraphNeuralNetworks/docs/ -e '
7256
using Pkg;
73-
Pkg.develop(PackageSpec(path=joinpath(pwd(), "GraphNeuralNetworks")));
74-
Pkg.instantiate();'
75-
- name: Build main docs
57+
pkg"dev ./GraphNeuralNetworks ./GNNlib ./GNNGraphs";
58+
Pkg.instantiate();
59+
include("GraphNeuralNetworks/docs/make.jl")'
7660
env:
7761
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
7862
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
79-
run: julia --project=GraphNeuralNetworks/docs/make.jl
8063

8164
# Build tutorials
8265
- name: Install dependencies for tutorials
83-
run: julia --project=tutorials/docs/ -e 'using Pkg; Pkg.instantiate();'
84-
- name: Build tutorials
66+
run: julia --project=tutorials/docs/ -e '
67+
using Pkg;
68+
pkg"dev ./GraphNeuralNetworks ./GNNlib ./GNNGraphs";
69+
Pkg.instantiate();
70+
include("tutorials/docs/make.jl")'
8571
env:
8672
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
8773
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
88-
run: julia --project=tutorials/docs/ tutorials/docs/make.jl
89-
74+
9075
# Build and deploy multidocs
9176
- name: Install dependencies for multidocs
9277
run: julia --project=docs/ -e '
9378
using Pkg;
94-
Pkg.develop([PackageSpec(path=joinpath(pwd(), "GraphNeuralNetworks")),
95-
PackageSpec(path=joinpath(pwd(), "GNNGraphs")),
96-
PackageSpec(path=joinpath(pwd(), "GNNlib")),
97-
PackageSpec(path=joinpath(pwd(), "GNNLux"))]);
79+
pkg"dev ./GraphNeuralNetworks ./GNNlib ./GNNGraphs ./GNNLux";
9880
Pkg.instantiate();'
9981
- name: Check if objects.inv exists for GraphNeuralNetworks
10082
run: |

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ GNNGraphs/docs/build
1515
GNNlib/docs/build
1616
GNNLux/docs/build
1717
GraphNeuralNetworks/docs/build
18-
GraphNeuralNetworks/docs/src/other
18+
GraphNeuralNetworks/docs/src/GNNGraphs
19+
GraphNeuralNetworks/docs/src/GNNlib
1920
tutorials/docs/build

GNNGraphs/docs/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
44
GNNGraphs = "aed8fd31-079b-4b5a-b342-a13352159b8c"
55
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
66
LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589"
7+
MLDatasets = "eb30cadb-4394-5ae3-aed4-317e484a6458"
8+
MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54"
9+
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

GNNGraphs/docs/make.jl

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,48 @@ using GNNGraphs
44
import Graphs
55
using Graphs: induced_subgraph
66

7-
assets=[]
8-
prettyurls = get(ENV, "CI", nothing) == "true"
9-
mathengine = MathJax3()
107

8+
DocMeta.setdocmeta!(GNNGraphs, :DocTestSetup, :(using GNNGraphs, MLUtils); recursive = true)
9+
10+
mathengine = MathJax3(Dict(:loader => Dict("load" => ["[tex]/require", "[tex]/mathtools"]),
11+
:tex => Dict("inlineMath" => [["\$", "\$"], ["\\(", "\\)"]],
12+
"packages" => [
13+
"base",
14+
"ams",
15+
"autoload",
16+
"mathtools",
17+
"require"
18+
])))
1119

1220
makedocs(;
13-
modules = [GNNGraphs],
14-
doctest = false,
15-
clean = true,
16-
format = Documenter.HTML(; mathengine, prettyurls, assets = assets, size_threshold=nothing),
17-
sitename = "GNNGraphs.jl",
18-
pages = ["Home" => "index.md",
19-
"Guides" => [
20-
"Graphs" => ["guides/gnngraph.md", "guides/heterograph.md", "guides/temporalgraph.md"],
21-
"Datasets" => "guides/datasets.md",
22-
],
23-
"API Reference" => [
24-
"GNNGraph" => "api/gnngraph.md",
25-
"GNNHeteroGraph" => "api/heterograph.md",
26-
"TemporalSnapshotsGNNGraph" => "api/temporalgraph.md",
27-
"Samplers" => "api/samplers.md",
28-
],
29-
]
30-
)
21+
modules = [GNNGraphs],
22+
doctest = false, # TODO enable doctest
23+
format = Documenter.HTML(; mathengine,
24+
prettyurls = get(ENV, "CI", nothing) == "true",
25+
assets = [],
26+
size_threshold=nothing,
27+
size_threshold_warn=200000),sitename = "GNNGraphs.jl",
28+
pages = [
29+
"Home" => "index.md",
30+
31+
"Guides" => [
32+
"Graphs" => [
33+
"guides/gnngraph.md",
34+
"guides/heterograph.md",
35+
"guides/temporalgraph.md"
36+
],
37+
"Datasets" => "guides/datasets.md",
38+
],
39+
40+
"API Reference" => [
41+
"GNNGraph" => "api/gnngraph.md",
42+
"GNNHeteroGraph" => "api/heterograph.md",
43+
"TemporalSnapshotsGNNGraph" => "api/temporalgraph.md",
44+
"Samplers" => "api/samplers.md",
45+
],
46+
]
47+
)
3148

32-
deploydocs(;repo = "github.com/JuliaGraphs/GraphNeuralNetworks.jl.git", devbranch = "master", dirname = "GNNGraphs")
49+
deploydocs(repo = "github.com/JuliaGraphs/GraphNeuralNetworks.jl.git",
50+
devbranch = "master",
51+
dirname = "GNNGraphs")

GNNGraphs/docs/src/guides/gnngraph.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,10 @@ that contains the total number of the original nodes
155155
and where the original graphs are disjoint subgraphs.
156156

157157
```julia
158-
using Flux
159-
using Flux: DataLoader
158+
using MLUtils
160159

161160
data = [rand_graph(10, 30, ndata=rand(Float32, 3, 10)) for _ in 1:160]
162-
gall = Flux.batch(data)
161+
gall = MLUtils.batch(data)
163162

164163
# gall is a GNNGraph containing many graphs
165164
@assert gall.num_graphs == 160
@@ -172,7 +171,7 @@ g23 = getgraph(gall, 2:3)
172171
@assert g23.num_nodes == 20 # 10 nodes x 2 graphs
173172
@assert g23.num_edges == 60 # 30 undirected edges X 2 graphs
174173

175-
# We can pass a GNNGraph to Flux's DataLoader
174+
# We can pass a GNNGraph to MLUtils' DataLoader
176175
train_loader = DataLoader(gall, batchsize=16, shuffle=true)
177176

178177
for g in train_loader
@@ -193,7 +192,7 @@ an option for mini-batch iteration, the recommended way for better performance i
193192
to pass an array of graphs directly and set the `collate` option to `true`:
194193

195194
```julia
196-
using Flux: DataLoader
195+
using MLUtils: DataLoader
197196

198197
data = [rand_graph(10, 30, ndata=rand(Float32, 3, 10)) for _ in 1:320]
199198

@@ -220,7 +219,7 @@ g′ = add_edges(g, [1, 2], [2, 3]) # add edges 1->2 and 2->3
220219
Move a `GNNGraph` to a CUDA device using `Flux.gpu` method.
221220

222221
```julia
223-
using CUDA, Flux
222+
using Flux, CUDA # or using Metal or using AMDGPU
224223

225224
g_gpu = g |> Flux.gpu
226225
```

GNNGraphs/docs/src/guides/heterograph.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ the type [`GNNHeteroGraph`](@ref).
1313
## Creating a Heterograph
1414

1515
A heterograph can be created empty or by passing pairs `edge_type => data` to the constructor.
16-
```jldoctest
16+
```jldoctest hetero
17+
julia> using GNNGraphs
18+
1719
julia> g = GNNHeteroGraph()
1820
GNNHeteroGraph:
1921
num_nodes: Dict()
@@ -31,7 +33,7 @@ GNNHeteroGraph:
3133
num_edges: Dict((:user, :rate, :movie) => 4)
3234
```
3335
New relations, possibly with new node types, can be added with the function [`add_edges`](@ref).
34-
```jldoctest
36+
```jldoctest hetero
3537
julia> g = add_edges(g, (:user, :like, :actor) => ([1,2,3,3,3], [3,5,1,9,4]))
3638
GNNHeteroGraph:
3739
num_nodes: Dict(:actor => 9, :movie => 13, :user => 3)
@@ -40,7 +42,7 @@ GNNHeteroGraph:
4042
See [`rand_heterograph`](@ref), [`rand_bipartite_heterograph`](@ref)
4143
for generating random heterographs.
4244

43-
```jldoctest
45+
```jldoctest hetero
4446
julia> g = rand_bipartite_heterograph((10, 15), 20)
4547
GNNHeteroGraph:
4648
num_nodes: Dict(:A => 10, :B => 15)
@@ -50,7 +52,7 @@ GNNHeteroGraph:
5052
## Basic Queries
5153

5254
Basic queries are similar to those for homogeneous graphs:
53-
```jldoctest
55+
```jldoctest hetero
5456
julia> g = GNNHeteroGraph((:user, :rate, :movie) => ([1,1,2,3], [7,13,5,7]))
5557
GNNHeteroGraph:
5658
num_nodes: Dict(:movie => 13, :user => 3)
@@ -84,7 +86,7 @@ julia> g.etypes
8486
## Data Features
8587

8688
Node, edge, and graph features can be added at construction time or later using:
87-
```jldoctest
89+
```jldoctest hetero
8890
# equivalent to g.ndata[:user][:x] = ...
8991
julia> g[:user].x = rand(Float32, 64, 3);
9092
@@ -106,10 +108,10 @@ GNNHeteroGraph:
106108

107109
## Batching
108110
Similarly to graphs, also heterographs can be batched together.
109-
```jldoctest
111+
```jldoctest hetero
110112
julia> gs = [rand_bipartite_heterograph((5, 10), 20) for _ in 1:32];
111113
112-
julia> Flux.batch(gs)
114+
julia> MLUtils.batch(gs)
113115
GNNHeteroGraph:
114116
num_nodes: Dict(:A => 160, :B => 320)
115117
num_edges: Dict((:A, :to, :B) => 640, (:B, :to, :A) => 640)
@@ -118,7 +120,7 @@ GNNHeteroGraph:
118120
Batching is automatically performed by the [`DataLoader`](https://fluxml.ai/Flux.jl/stable/data/mlutils/#MLUtils.DataLoader) iterator
119121
when the `collate` option is set to `true`.
120122

121-
```jldoctest
123+
```jldoctest hetero
122124
using Flux: DataLoader
123125
124126
data = [rand_bipartite_heterograph((5, 10), 20,

GNNGraphs/docs/src/guides/temporalgraph.md

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ Temporal Graphs are graphs with time varying topologies and features. In GNNGra
66

77
A temporal graph can be created by passing a list of snapshots to the constructor. Each snapshot is a [`GNNGraph`](@ref).
88

9-
```jldoctest
9+
```jldoctest temporal
10+
julia> using GNNGraphs
11+
1012
julia> snapshots = [rand_graph(10,20) for i in 1:5];
1113
1214
julia> tg = TemporalSnapshotsGNNGraph(snapshots)
@@ -18,14 +20,14 @@ TemporalSnapshotsGNNGraph:
1820

1921
A new temporal graph can be created by adding or removing snapshots to an existing temporal graph.
2022

21-
```jldoctest
23+
```jldoctest temporal
2224
julia> new_tg = add_snapshot(tg, 3, rand_graph(10, 16)) # add a new snapshot at time 3
2325
TemporalSnapshotsGNNGraph:
2426
num_nodes: [10, 10, 10, 10, 10, 10]
2527
num_edges: [20, 20, 16, 20, 20, 20]
2628
num_snapshots: 6
2729
```
28-
```jldoctest
30+
```jldoctest temporal
2931
julia> snapshots = [rand_graph(10,20), rand_graph(10,14), rand_graph(10,22)];
3032
3133
julia> tg = TemporalSnapshotsGNNGraph(snapshots)
@@ -43,7 +45,7 @@ TemporalSnapshotsGNNGraph:
4345

4446
See [`rand_temporal_radius_graph`](@ref) and [`rand_temporal_hyperbolic_graph`](@ref) for generating random temporal graphs.
4547

46-
```jldoctest
48+
```jldoctest temporal
4749
julia> tg = rand_temporal_radius_graph(10, 3, 0.1, 0.5)
4850
TemporalSnapshotsGNNGraph:
4951
num_nodes: [10, 10, 10]
@@ -54,7 +56,7 @@ TemporalSnapshotsGNNGraph:
5456
## Basic Queries
5557

5658
Basic queries are similar to those for [`GNNGraph`](@ref)s:
57-
```jldoctest
59+
```jldoctest temporal
5860
julia> snapshots = [rand_graph(10,20), rand_graph(10,14), rand_graph(10,22)];
5961
6062
julia> tg = TemporalSnapshotsGNNGraph(snapshots)
@@ -94,7 +96,7 @@ GNNGraph:
9496
A temporal graph can store global feature for the entire time series in the `tgdata` filed.
9597
Also, each snapshot can store node, edge, and graph features in the `ndata`, `edata`, and `gdata` fields, respectively.
9698

97-
```jldoctest
99+
```jldoctest temporal
98100
julia> snapshots = [rand_graph(10,20; ndata = rand(3,10)), rand_graph(10,14; ndata = rand(4,10)), rand_graph(10,22; ndata = rand(5,10))]; # node features at construction time
99101
100102
julia> tg = TemporalSnapshotsGNNGraph(snapshots);
@@ -124,22 +126,4 @@ julia> [g.x for g in tg.snapshots]; # same vector as above, now accessing
124126
# the x feature directly from the snapshots
125127
```
126128

127-
## Graph convolutions on TemporalSnapshotsGNNGraph
128-
129-
A graph convolutional layer can be applied to each snapshot independently, in the next example we apply a `GINConv` layer to each snapshot of a `TemporalSnapshotsGNNGraph`.
130-
131-
```jldoctest
132-
julia> using GNNGraphs, Flux
133-
134-
julia> snapshots = [rand_graph(10, 20; ndata = rand(3, 10)), rand_graph(10, 14; ndata = rand(3, 10))];
135-
136-
julia> tg = TemporalSnapshotsGNNGraph(snapshots);
137-
138-
julia> m = GINConv(Dense(3 => 1), 0.4);
139-
140-
julia> output = m(tg, tg.ndata.x);
141-
142-
julia> size(output[1])
143-
(1, 10)
144-
```
145129

0 commit comments

Comments
 (0)