@@ -11,28 +11,34 @@ const ADJMAT_T = AbstractMatrix
1111const SPARSE_T = AbstractSparseMatrix # subset of ADJMAT_T
1212const CUMAT_T = Union{AnyCuMatrix, CUDA. CUSPARSE. CuSparseMatrix}
1313
14- """
14+ """
1515 GNNGraph(data; [graph_type, ndata, edata, gdata, num_nodes, graph_indicator, dir])
1616 GNNGraph(g::GNNGraph; [ndata, edata, gdata])
1717
18- A type representing a graph structure and storing also
19- feature arrays associated to nodes, edges, and to the whole graph (global features) .
18+ A type representing a graph structure that also stores
19+ feature arrays associated to nodes, edges, and the graph itself .
2020
21- A `GNNGraph` can be constructed out of different objects `data` expressing
22- the connections inside the graph. The internal representation type
21+ A `GNNGraph` can be constructed out of different `data` objects
22+ expressing the connections inside the graph. The internal representation type
2323is determined by `graph_type`.
2424
2525When 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.
26+ is preserved and shared. The node/edge/graph features are retained
27+ as well, unless explicitely set by the keyword arguments
28+ `ndata`, `edata`, and `gdata`.
2829
2930A `GNNGraph` can also represent multiple graphs batched togheter
3031(see [`Flux.batch`](@ref) or [`SparseArrays.blockdiag`](@ref)).
3132The field `g.graph_indicator` contains the graph membership
3233of each node.
3334
34- A `GNNGraph` is a Graphs' `AbstractGraph`, therefore any functionality
35- from the Graphs' graph library can be used on it.
35+ `GNNGraph`s are always directed graphs, therefore each edge is defined
36+ by a source node and a target node (see [`edge_index`](@ref)).
37+ Self loops (edges connecting a node to itself) and multiple edges
38+ (more than one edge between the same pair of nodes) are supported.
39+
40+ A `GNNGraph` is a Graphs.jl's `AbstractGraph`, therefore it supports most
41+ functionality from that library.
3642
3743# Arguments
3844
@@ -54,9 +60,9 @@ from the Graphs' graph library can be used on it.
5460 Possible values are `:out` and `:in`. Default `:out`.
5561- `num_nodes`: The number of nodes. If not specified, inferred from `g`. Default `nothing`.
5662- `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.
63+ - `ndata`: Node features. A named tuple of arrays whose last dimension has size ` num_nodes` .
64+ - `edata`: Edge features. A named tuple of arrays whose last dimension has size ` num_edges` .
65+ - `gdata`: Graph features. A named tuple of arrays whose last dimension has size ` num_graphs` .
6066
6167# Usage.
6268
@@ -97,7 +103,7 @@ g = g |> gpu
97103source, target = edge_index(g)
98104```
99105"""
100- struct GNNGraph{T<: Union{COO_T,ADJMAT_T} }
106+ struct GNNGraph{T<: Union{COO_T,ADJMAT_T} } <: AbstractGraph{Int}
101107 graph:: T
102108 num_nodes:: Int
103109 num_edges:: Int
0 commit comments