Skip to content

Commit eefe691

Browse files
make add_snapshot non mutating (#296)
* snapshot! * doc pages * fixes * more tests * fix add_snapshot * fix docs * fix docs
1 parent 57bcddc commit eefe691

16 files changed

+246
-96
lines changed

docs/make.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using Flux, NNlib, GraphNeuralNetworks, Graphs, SparseArrays
22
using Documenter, DemoCards
33

4-
tutorials, tutorials_cb, tutorial_assets = makedemos("tutorials")
4+
# tutorials, tutorials_cb, tutorial_assets = makedemos("tutorials")
55

66
assets = []
7-
isnothing(tutorial_assets) || push!(assets, tutorial_assets)
7+
# isnothing(tutorial_assets) || push!(assets, tutorial_assets)
88

99
DocMeta.setdocmeta!(GraphNeuralNetworks, :DocTestSetup,
1010
:(using GraphNeuralNetworks, Graphs, SparseArrays, NNlib, Flux);
@@ -20,24 +20,25 @@ makedocs(;
2020
format = Documenter.HTML(; mathengine, prettyurls, assets = assets),
2121
sitename = "GraphNeuralNetworks.jl",
2222
pages = ["Home" => "index.md",
23-
"Graphs" => "gnngraph.md",
23+
"Graphs" => ["gnngraph.md", "heterograph.md", "temporalgraph.md"],
2424
"Message Passing" => "messagepassing.md",
2525
"Model Building" => "models.md",
2626
"Datasets" => "datasets.md",
27-
"HeteroGraphs" => "gnnheterograph.md",
28-
"Tutorials" => tutorials,
27+
# "Tutorials" => tutorials,
2928
"API Reference" => [
3029
"GNNGraph" => "api/gnngraph.md",
3130
"Basic Layers" => "api/basic.md",
3231
"Convolutional Layers" => "api/conv.md",
3332
"Pooling Layers" => "api/pool.md",
3433
"Message Passing" => "api/messagepassing.md",
34+
"Heterogeneous Graphs" => "api/heterograph.md",
35+
"Temporal Graphs" => "api/temporalgraph.md",
3536
"Utils" => "api/utils.md",
3637
],
3738
"Developer Notes" => "dev.md",
3839
"Summer Of Code" => "gsoc.md",
3940
])
4041

41-
tutorials_cb()
42+
# tutorials_cb()
4243

4344
deploydocs(repo = "github.com/CarloLucibello/GraphNeuralNetworks.jl.git")

docs/src/api/basic.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ CurrentModule = GraphNeuralNetworks
77
## Index
88

99
```@index
10-
Order = [:type, :function]
1110
Modules = [GraphNeuralNetworks]
1211
Pages = ["basic.md"]
1312
```

docs/src/api/heterograph.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# HeteroGNNGraph
2+
3+
Documentation page for the graph type `HeteroGNNGraph` and related methods representing heterogeneous graphs,
4+
where nodes and edges can have different types.
5+
6+
7+
```@autodocs
8+
Modules = [GraphNeuralNetworks.GNNGraphs]
9+
Pages = ["gnnheterograph.jl"]
10+
Private = false
11+
```

docs/src/api/temporalgraph.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# TemporalSnapthotsGNNGraph
2+
3+
4+
Documentation page for the graph type `TemporalSnapshotsGNNGraph` and related methods, representing time varying graphs with time varying features.
5+
6+
```@docs
7+
TemporalSnapshotsGNNGraph
8+
add_snapshot
9+
remove_snapshot
10+
```

docs/src/gnngraph.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Graphs
1+
# Working with GNNGraph
22

33
The fundamental graph type in GraphNeuralNetworks.jl is the [`GNNGraph`](@ref).
44
A GNNGraph `g` is a directed graph with nodes labeled from 1 to `g.num_nodes`.
@@ -254,4 +254,4 @@ julia> GNNGraph(gd)
254254
GNNGraph:
255255
num_nodes: 10
256256
num_edges: 20
257-
```
257+
```
Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Heterogeneous Graphs
22

3-
!!! warning
4-
Heterographs support is still experimental.
5-
The interface could be subject to change in the future.
6-
73
Heterogeneus graphs (also called heterographs), are graphs where each node has a type,
84
that we denote with symbols such as `:user` and `:movie`,
95
and edges also represent different relations identified
@@ -16,10 +12,3 @@ and data containers.
1612
In GraphNeuralNetworks.jl heterographs are implemented in
1713
the type [`GNNHeteroGraph`](@ref).
1814

19-
20-
```@docs
21-
GNNHeteroGraph
22-
rand_heterograph
23-
```
24-
25-

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ opt = Adam(1f-4)
6161

6262
Finally, we use a standard Flux training pipeline to fit our dataset.
6363
We use Flux's `DataLoader` to iterate over mini-batches of graphs
64-
that are glued together into a single `GNNGraph` using the [`MLUtils.batch`](@ref) method. This is what happens under the hood when creating a `DataLoader` with the
64+
that are glued together into a single `GNNGraph` using the [`Flux.batch`](@ref) method. This is what happens under the hood when creating a `DataLoader` with the
6565
`collate=true` option.
6666

6767
```julia

docs/src/temporalgraph.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Temporal Graphs
2+
3+
Time varying graph topologies and node features are supported through the [`TemporalSnapshotsGNNGraph`](@ref) type.

src/GNNGraphs/GNNGraphs.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,16 @@ export GNNGraph,
2828
graph_features
2929

3030
include("gnnheterograph.jl")
31-
export GNNHeteroGraph
32-
31+
export GNNHeteroGraph,
32+
num_edge_types,
33+
num_node_types
3334

3435
include("temporalsnapshotsgnngraph.jl")
3536
export TemporalSnapshotsGNNGraph,
3637
add_snapshot,
38+
# add_snapshot!,
3739
remove_snapshot
40+
# remove_snapshot!
3841

3942
include("query.jl")
4043
export adjacency_list,

src/GNNGraphs/generate.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Additional keyword arguments will be passed to the [`GNNHeteroGraph`](@ref) cons
6060
6161
# Examples
6262
63-
```juliarepl
63+
```julia-repl
6464
6565
6666
julia> g = rand_heterograph((:user => 10, :movie => 20),
@@ -70,7 +70,7 @@ GNNHeteroGraph:
7070
num_edges: ((:user, :rate, :movie) => 30,)
7171
```
7272
"""
73-
function rand_heteropraph end
73+
function rand_heterograph end
7474

7575
# for generic iterators of pairs
7676
rand_heterograph(n, m; kws...) = rand_heterograph(Dict(n), Dict(m); kws...)

0 commit comments

Comments
 (0)