Skip to content

Commit f967954

Browse files
Merge pull request #1 from CarloLucibello/cl/nullgraph
layers do not store graphs internally
2 parents 14ab918 + 86c9f6d commit f967954

File tree

14 files changed

+262
-740
lines changed

14 files changed

+262
-740
lines changed

.github/workflows/CI.yml

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
name: CI
22
on:
3-
- push
4-
- pull_request
3+
pull_request:
4+
branches:
5+
- master
6+
push:
7+
branches:
8+
- master
9+
tags: '*'
510
jobs:
611
test:
712
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
@@ -10,7 +15,8 @@ jobs:
1015
fail-fast: false
1116
matrix:
1217
version:
13-
- '1.6'
18+
- '1.6' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'.
19+
- '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia.
1420
- 'nightly'
1521
os:
1622
- ubuntu-latest
@@ -37,28 +43,5 @@ jobs:
3743
- uses: julia-actions/julia-processcoverage@v1
3844
- uses: codecov/codecov-action@v1
3945
with:
46+
# token: ${{ secrets.CODECOV_TOKEN }}
4047
file: lcov.info
41-
docs:
42-
name: Documentation
43-
runs-on: ubuntu-latest
44-
steps:
45-
- uses: actions/checkout@v2
46-
- uses: julia-actions/setup-julia@v1
47-
with:
48-
version: '1'
49-
- run: |
50-
julia --project=docs -e '
51-
using Pkg
52-
Pkg.develop(PackageSpec(path=pwd()))
53-
Pkg.instantiate()'
54-
- run: |
55-
julia --project=docs -e '
56-
using Documenter: DocMeta, doctest
57-
using GraphNeuralNetworks
58-
DocMeta.setdocmeta!(GraphNeuralNetworks, :DocTestSetup, :(using GraphNeuralNetworks); recursive=true)
59-
doctest(GraphNeuralNetworks)'
60-
- run: julia --project=docs docs/make.jl
61-
env:
62-
JULIA_PKG_SERVER: ""
63-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64-
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}

.github/workflows/docs.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags: '*'
8+
pull_request:
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: julia-actions/setup-julia@latest
16+
with:
17+
version: '1.6'
18+
- name: Install dependencies
19+
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
20+
- name: Build and deploy
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
23+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key
24+
run: julia --project=docs/ docs/make.jl

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
*.jl.*.cov
22
*.jl.cov
33
*.jl.mem
4-
/Manifest.toml
4+
Manifest.toml
55
/docs/build/

README.md

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
11
# GraphNeuralNetworks.jl
22

3-
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://fluxml.ai/GraphNeuralNetworks.jl/stable)
4-
[![](https://img.shields.io/badge/docs-dev-blue.svg)](https://fluxml.ai/GraphNeuralNetworks.jl/dev)
3+
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://CarloLucibello.github.io/GraphNeuralNetworks.jl/stable)
4+
[![](https://img.shields.io/badge/docs-dev-blue.svg)](https://CarloLucibello.github.io/GraphNeuralNetworks.jl/dev)
55
![](https://github.com/CarloLucibello/GraphNeuralNetworks.jl/actions/workflows/ci.yml/badge.svg)
66
[![codecov](https://codecov.io/gh/FluxML/GraphNeuralNetworks.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/CarloLucibello/GraphNeuralNetworks.jl)
77

8-
GraphNeuralNetworks is a geometric deep learning library for [Flux](https://github.com/FluxML/Flux.jl). This library aims to be compatible with packages from [JuliaGraphs](https://github.com/JuliaGraphs) ecosystem and have support of CUDA GPU acceleration with [CUDA](https://github.com/JuliaGPU/CUDA.jl). Message passing scheme is implemented as a flexbile framework and fused with Graph Network block scheme. GraphNeuralNetworks is compatible with other packages that are composable with Flux.
8+
*GraphNeuralNetworks* is a graph neural network library for Julia based on the [Flux.jl](https://github.com/FluxML/Flux.jl) deep learning framework.
99

10-
Suggestions, issues and pull requsts are welcome.
10+
Some of its noticeable features are the following:
11+
12+
* Based on the Flux deep learning framework.
13+
* CUDA support.
14+
* Integrated with the JuliaGraphs ecosystem.
15+
* Supports generic graph neural network architectures.
16+
* Easy to define custom graph convolutional layers.
1117

1218
## Installation
1319

1420
```julia
1521
]add GraphNeuralNetworks
1622
```
1723

18-
## Features
19-
20-
* Extend Flux deep learning framework in Julia and compatible with Flux layers.
21-
* Support of CUDA GPU with CUDA.jl
22-
* Integrate with existing JuliaGraphs ecosystem
23-
* Support generic graph neural network architectures
24-
* Variable graph inputs are supported. You use it when diverse graph structures are prepared as inputs to the same model.
25-
2624
## Featured Graphs
2725

28-
GraphNeuralNetworks handles graph data (the topology plus node/vertex/graph features)
26+
GraphNeuralNetworks handles graph data (the graph topology + node/edge/global features)
2927
thanks to the type `FeaturedGraph`.
3028

3129
A `FeaturedGraph` can be constructed out of
@@ -34,26 +32,45 @@ adjacency matrices, adjacency lists, LightGraphs' types...
3432
```julia
3533
fg = FeaturedGraph(adj_list)
3634
```
35+
3736
## Graph convolutional layers
3837

3938
Construct a GCN layer:
4039

4140
```julia
42-
GCNConv([fg,] input_dim => output_dim, relu)
41+
GCNConv(input_dim => output_dim, relu)
4342
```
4443

45-
## Use it as you use Flux
44+
## Usage Example
4645

4746
```julia
48-
model = Chain(GCNConv(fg, 1024 => 512, relu),
49-
Dropout(0.5),
50-
GCNConv(fg, 512 => 128),
51-
Dense(128, 10))
52-
## Loss
53-
loss(x, y) = logitcrossentropy(model(x), y)
54-
accuracy(x, y) = mean(onecold(model(x)) .== onecold(y))
55-
56-
## Training
47+
struct GNN
48+
conv1
49+
conv2
50+
dense
51+
end
52+
53+
@functor GNN
54+
55+
function GNN()
56+
GNN(GCNConv(1024=>512, relu),
57+
GCNConv(512=>128, relu),
58+
Dense(128, 10))
59+
end
60+
61+
function (net::GNN)(g, x)
62+
x = net.conv1(g, x)
63+
x = dropout(x, 0.5)
64+
x = net.conv2(g, x)
65+
x = net.dense(x)
66+
return x
67+
end
68+
69+
model = GNN()
70+
71+
loss(x, y) = logitcrossentropy(model(fg, x), y)
72+
accuracy(x, y) = mean(onecold(model(fg, x)) .== onecold(y))
73+
5774
ps = Flux.params(model)
5875
train_data = [(train_X, train_y)]
5976
opt = ADAM(0.01)

docs/Manifest.toml

Lines changed: 0 additions & 97 deletions
This file was deleted.

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3-
GraphNeuralNetworks = "b59e9cf9-92e9-4253-8889-0456869b82e0"
3+
GraphNeuralNetworks = "cffab07f-9bc2-4db1-8861-388f63bf7694"

docs/make.jl

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,10 @@ DocMeta.setdocmeta!(GraphNeuralNetworks, :DocTestSetup, :(using GraphNeuralNetwo
55

66
makedocs(;
77
modules=[GraphNeuralNetworks],
8-
authors="Carlo Lucibello <[email protected]> and contributors",
9-
repo="https://github.com/CarloLucibello/GraphNeuralNetworks.jl/blob/{commit}{path}#{line}",
10-
sitename="GraphNeuralNetworks.jl",
11-
format=Documenter.HTML(;
12-
prettyurls=get(ENV, "CI", "false") == "true",
13-
canonical="https://CarloLucibello.github.io/GraphNeuralNetworks.jl",
14-
assets=String[],
15-
),
8+
sitename = "GraphNeuralNetworks.jl",
169
pages=[
1710
"Home" => "index.md",
1811
],
1912
)
2013

21-
deploydocs(;
22-
repo="github.com/CarloLucibello/GraphNeuralNetworks.jl",
23-
)
14+
deploydocs(repo="github.com/CarloLucibello/GraphNeuralNetworks.jl.git")

src/GraphNeuralNetworks.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ include("layers/msgpass.jl")
6464

6565
include("layers/conv.jl")
6666
include("layers/pool.jl")
67-
include("models.jl")
6867
include("layers/misc.jl")
6968

7069

src/featuredgraph.jl

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,7 @@ https://juliagraphs.org/LightGraphs.jl/latest/types/#AbstractGraph-Type
55
https://juliagraphs.org/LightGraphs.jl/latest/developing/#Developing-Alternate-Graph-Types
66
=============================================#
77

8-
abstract type AbstractFeaturedGraph <: AbstractGraph{Int} end
9-
10-
"""
11-
NullGraph()
12-
13-
Null object for `FeaturedGraph`.
14-
"""
15-
struct NullGraph <: AbstractFeaturedGraph end
16-
17-
const COO_T = Tuple{T, T, V} where {T <: AbstractVector,V}
8+
const COO_T = Tuple{T, T, V} where {T <: AbstractVector, V}
189
const ADJLIST_T = AbstractVector{T} where T <: AbstractVector
1910
const ADJMAT_T = AbstractMatrix
2011
const SPARSE_T = AbstractSparseMatrix # subset of ADJMAT_T
@@ -93,7 +84,7 @@ source, target = edge_index(fg)
9384
9485
See also [`graph`](@ref), [`edge_index`](@ref), [`node_feature`](@ref), [`edge_feature`](@ref), and [`global_feature`](@ref)
9586
"""
96-
struct FeaturedGraph{T<:Union{COO_T,ADJMAT_T}} <: AbstractFeaturedGraph
87+
struct FeaturedGraph{T<:Union{COO_T,ADJMAT_T}}
9788
graph::T
9889
num_nodes::Int
9990
num_edges::Int

0 commit comments

Comments
 (0)