@@ -11,28 +11,35 @@ const ADJMAT_T = AbstractMatrix
11
11
const SPARSE_T = AbstractSparseMatrix # subset of ADJMAT_T
12
12
const CUMAT_T = Union{CUDA. AnyCuMatrix, CUDA. CUSPARSE. CuSparseMatrix}
13
13
14
- """
14
+
15
+ """
15
16
GNNGraph(data; [graph_type, ndata, edata, gdata, num_nodes, graph_indicator, dir])
16
17
GNNGraph(g::GNNGraph; [ndata, edata, gdata])
17
18
18
- A type representing a graph structure and storing also
19
- feature arrays associated to nodes, edges, and to the whole graph (global features) .
19
+ A type representing a graph structure that also stores
20
+ feature arrays associated to nodes, edges, and the graph itself .
20
21
21
- A `GNNGraph` can be constructed out of different objects `data` expressing
22
- the connections inside the graph. The internal representation type
22
+ A `GNNGraph` can be constructed out of different `data` objects
23
+ expressing the connections inside the graph. The internal representation type
23
24
is determined by `graph_type`.
24
25
25
26
When constructed from another `GNNGraph`, the internal graph representation
26
- is preserved and shared. The node/edge/global features are transmitted
27
- as well, unless explicitely changed though keyword arguments.
27
+ is preserved and shared. The node/edge/graph features are retained
28
+ as well, unless explicitely set by the keyword arguments
29
+ `ndata`, `edata`, and `gdata`.
28
30
29
31
A `GNNGraph` can also represent multiple graphs batched togheter
30
32
(see [`Flux.batch`](@ref) or [`SparseArrays.blockdiag`](@ref)).
31
- Use [` graph_indicator`](@ref) to obtain the graph membership
33
+ The field `g. graph_indicator` contains the graph membership
32
34
of each node.
33
35
34
- A `GNNGraph` is a Graphs' `AbstractGraph`, therefore any functionality
35
- from the Graphs' graph library can be used on it.
36
+ `GNNGraph`s are always directed graphs, therefore each edge is defined
37
+ by a source node and a target node (see [`edge_index`](@ref)).
38
+ Self loops (edges connecting a node to itself) and multiple edges
39
+ (more than one edge between the same pair of nodes) are supported.
40
+
41
+ A `GNNGraph` is a Graphs.jl's `AbstractGraph`, therefore it supports most
42
+ functionality from that library.
36
43
37
44
# Arguments
38
45
@@ -54,9 +61,9 @@ from the Graphs' graph library can be used on it.
54
61
Possible values are `:out` and `:in`. Default `:out`.
55
62
- `num_nodes`: The number of nodes. If not specified, inferred from `g`. Default `nothing`.
56
63
- `graph_indicator`: For batched graphs, a vector containing the graph assigment of each node. Default `nothing`.
57
- - `ndata`: Node features. A named tuple of arrays whose last dimension has size num_nodes.
58
- - `edata`: Edge features. A named tuple of arrays whose whose last dimension has size num_edges.
59
- - `gdata`: Global features. A named tuple of arrays whose has size num_graphs.
64
+ - `ndata`: Node features. A named tuple of arrays whose last dimension has size ` num_nodes` .
65
+ - `edata`: Edge features. A named tuple of arrays whose last dimension has size ` num_edges` .
66
+ - `gdata`: Graph features. A named tuple of arrays whose last dimension has size ` num_graphs` .
60
67
61
68
# Usage.
62
69
@@ -97,7 +104,7 @@ g = g |> gpu
97
104
source, target = edge_index(g)
98
105
```
99
106
"""
100
- struct GNNGraph{T<: Union{COO_T,ADJMAT_T} }
107
+ struct GNNGraph{T<: Union{COO_T,ADJMAT_T} } <: AbstractGraph{Int}
101
108
graph:: T
102
109
num_nodes:: Int
103
110
num_edges:: Int
0 commit comments