@@ -15,10 +15,13 @@ A GNNGraph can be created from several different data sources encoding the graph
15
15
using GraphNeuralNetworks, Graphs, SparseArrays
16
16
17
17
18
- # Construct GNNGraph from From Graphs's graph
18
+ # Construct a GNNGraph from from a Graphs.jl 's graph
19
19
lg = erdos_renyi (10 , 30 )
20
20
g = GNNGraph (lg)
21
21
22
+ # Same as above using convenience method rand_graph
23
+ g = rand_graph (10 , 30 )
24
+
22
25
# From an adjacency matrix
23
26
A = sprand (10 , 10 , 0.3 )
24
27
g = GNNGraph (A)
@@ -33,7 +36,7 @@ target = [2,3,1,3,1,2,4,3]
33
36
g = GNNGraph (source, target)
34
37
```
35
38
36
- See also the related methods [ ` adjacency_matrix ` ] ( @ref ) , [ ` edge_index ` ] ( @ref ) , and [ ` adjacency_list ` ] ( @ref ) .
39
+ See also the related methods [ ` Graphs. adjacency_matrix` ] ( @ref ) , [ ` edge_index ` ] ( @ref ) , and [ ` adjacency_list ` ] ( @ref ) .
37
40
38
41
## Basic Queries
39
42
@@ -123,21 +126,21 @@ for g in train_loader
123
126
.....
124
127
end
125
128
126
- # Access the nodes' graph memberships through
127
- gall . graph_indicator
129
+ # Access the nodes' graph memberships
130
+ graph_indicator (gall)
128
131
```
129
132
130
133
## Graph Manipulation
131
134
132
135
``` julia
133
136
g′ = add_self_loops (g)
134
-
135
137
g′ = remove_self_loops (g)
138
+ g′ = add_edges (g, [1 , 2 ], [2 , 3 ]) # add edges 1->2 and 2->3
136
139
```
137
140
138
141
## JuliaGraphs ecosystem integration
139
142
140
- Since ` GNNGraph <: Graphs.AbstractGraph ` , we can use any functionality from Graphs.
143
+ Since ` GNNGraph <: Graphs.AbstractGraph ` , we can use any functionality from Graphs.jl.
141
144
142
145
``` julia
143
146
@assert Graphs. isdirected (g)
0 commit comments