-
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.
Merge pull request #64 from CarloLucibello/cl/grah
refactor GNNGraph into submodule + implement add_edges
- Loading branch information
Showing
18 changed files
with
973 additions
and
814 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
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
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,43 @@ | ||
module GNNGraphs | ||
|
||
using SparseArrays | ||
using Functors: @functor | ||
using CUDA | ||
import Graphs | ||
using Graphs: AbstractGraph, outneighbors, inneighbors, adjacency_matrix, degree | ||
import Flux | ||
using Flux: batch | ||
import NNlib | ||
import LearnBase | ||
import StatsBase | ||
using LearnBase: getobs | ||
import KrylovKit | ||
using ChainRulesCore | ||
using LinearAlgebra, Random | ||
|
||
include("gnngraph.jl") | ||
export GNNGraph, node_features, edge_features, graph_features | ||
|
||
include("query.jl") | ||
export edge_index, adjacency_list, normalized_laplacian, scaled_laplacian, | ||
graph_indicator | ||
|
||
include("transform.jl") | ||
export add_edges, add_self_loops, remove_self_loops, getgraph | ||
|
||
include("generate.jl") | ||
export rand_graph | ||
|
||
|
||
include("convert.jl") | ||
include("utils.jl") | ||
|
||
export | ||
# from Graphs | ||
adjacency_matrix, degree, outneighbors, inneighbors, | ||
# from SparseArrays | ||
sprand, sparse, blockdiag, | ||
# from Flux | ||
batch | ||
|
||
end #module |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
""" | ||
rand_graph(n, m; directed=false, kws...) | ||
Generate a random (Erdós-Renyi) `GNNGraph` with `n` nodes. | ||
If `directed=false` the output will contain `2m` edges: | ||
the reverse edge of each edge will be present. | ||
If `directed=true` instead, `m` unrelated edges are generated. | ||
Additional keyword argument will be fed to the [`GNNGraph`](@ref) constructor. | ||
""" | ||
function rand_graph(n::Integer, m::Integer; directed=false, kws...) | ||
return GNNGraph(Graphs.erdos_renyi(n, m, is_directed=directed); kws...) | ||
end |
Oops, something went wrong.