Skip to content

Commit d68f529

Browse files
committed
Merge branch 'master' into new-multidocs
2 parents 3247938 + 9d9e8d0 commit d68f529

File tree

6 files changed

+28
-21
lines changed

6 files changed

+28
-21
lines changed

GNNGraphs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "GNNGraphs"
22
uuid = "aed8fd31-079b-4b5a-b342-a13352159b8c"
33
authors = ["Carlo Lucibello and contributors"]
4-
version = "1.2.0"
4+
version = "1.2.1"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

GNNGraphs/docs/src/temporalgraph.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ GNNGraph:
9191
```
9292

9393
## Data Features
94-
95-
Node, edge, and graph features can be added at construction time or later using:
94+
A temporal graph can stode global feautre for the entire time series in the `tgdata` filed.
95+
Also, each snapshot can store node, edge, and graph features in the `ndata`, `edata`, and `gdata` fields, respectively.
9696

9797
```jldoctest
9898
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
9999
100100
julia> tg = TemporalSnapshotsGNNGraph(snapshots);
101101
102-
julia> tg.tgdata.y = rand(3,1); # graph features after construction
102+
julia> tg.tgdata.y = rand(3,1); # add global features after construction
103103
104104
julia> tg
105105
TemporalSnapshotsGNNGraph:
@@ -109,7 +109,7 @@ TemporalSnapshotsGNNGraph:
109109
tgdata:
110110
y = 3×1 Matrix{Float64}
111111
112-
julia> tg.ndata # vector of Datastore for node features
112+
julia> tg.ndata # vector of DataStore containing node features for each snapshot
113113
3-element Vector{DataStore}:
114114
DataStore(10) with 1 element:
115115
x = 3×10 Matrix{Float64}
@@ -118,8 +118,10 @@ julia> tg.ndata # vector of Datastore for node features
118118
DataStore(10) with 1 element:
119119
x = 5×10 Matrix{Float64}
120120
121-
julia> typeof(tg.ndata.x) # vector containing the x feature of each snapshot
122-
Vector{Matrix{Float64}}
121+
julia> [ds.x for ds in tg.ndata]; # vector containing the x feature of each snapshot
122+
123+
julia> [g.x for g in tg.snapshots]; # same vector as above, now accessing
124+
# the x feature directly from the snapshots
123125
```
124126

125127
## Graph convolutions on TemporalSnapshotsGNNGraph

GNNGraphs/src/GNNGraphs.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,6 @@ include("gatherscatter.jl")
111111
include("mldatasets.jl")
112112
export mldataset2gnngraph
113113

114+
include("deprecations.jl")
115+
114116
end #module

GNNGraphs/src/datastore.jl

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,7 @@ function Base.getproperty(ds::DataStore, s::Symbol)
107107
end
108108
end
109109

110-
function Base.getproperty(vds::Vector{DataStore}, s::Symbol)
111-
if s === :_n
112-
return [getn(ds) for ds in vds]
113-
elseif s === :_data
114-
return [getdata(ds) for ds in vds]
115-
else
116-
return [getdata(ds)[s] for ds in vds]
117-
end
118-
end
110+
119111

120112
function Base.setproperty!(ds::DataStore, s::Symbol, x)
121113
@assert s != :_n "cannot set _n directly"

GNNGraphs/src/deprecations.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## Deprecated in V0.6
2+
3+
function Base.getproperty(vds::Vector{DataStore}, s::Symbol)
4+
if s (:ref, :size) # these are arrays fields in V0.11
5+
return getfield(vds, s)
6+
elseif s === :_n
7+
return [getn(ds) for ds in vds]
8+
elseif s === :_data
9+
return [getdata(ds) for ds in vds]
10+
else
11+
return [getdata(ds)[s] for ds in vds]
12+
end
13+
end

GNNGraphs/test/datastore.jl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ end
2020
@test_throws DimensionMismatch ds.z=rand(12)
2121
ds.z = [1:10;]
2222
@test ds.z == [1:10;]
23-
vec = [DataStore(10, (:x => x,)), DataStore(10, (:x => x, :y => rand(2, 10)))]
24-
@test vec.x == [x, x]
25-
@test_throws KeyError vec.z
26-
@test vec._n == [10, 10]
27-
@test vec._data == [Dict(:x => x), Dict(:x => x, :y => vec[2].y)]
23+
24+
# issue #504, where vector creation failed
25+
@test fill(DataStore(), 3) isa Vector
2826
end
2927

3028
@testset "setindex!" begin

0 commit comments

Comments
 (0)