Skip to content

Commit df874da

Browse files
fix rebase
1 parent 16a9362 commit df874da

File tree

2 files changed

+21
-635
lines changed

2 files changed

+21
-635
lines changed

src/GNNGraphs/gnngraph.jl

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,35 @@ const ADJMAT_T = AbstractMatrix
1111
const SPARSE_T = AbstractSparseMatrix # subset of ADJMAT_T
1212
const CUMAT_T = Union{CUDA.AnyCuMatrix, CUDA.CUSPARSE.CuSparseMatrix}
1313

14-
"""
14+
15+
"""
1516
GNNGraph(data; [graph_type, ndata, edata, gdata, num_nodes, graph_indicator, dir])
1617
GNNGraph(g::GNNGraph; [ndata, edata, gdata])
1718
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.
2021
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
2324
is determined by `graph_type`.
2425
2526
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`.
2830
2931
A `GNNGraph` can also represent multiple graphs batched togheter
3032
(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
3234
of each node.
3335
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.
3643
3744
# Arguments
3845
@@ -54,9 +61,9 @@ from the Graphs' graph library can be used on it.
5461
Possible values are `:out` and `:in`. Default `:out`.
5562
- `num_nodes`: The number of nodes. If not specified, inferred from `g`. Default `nothing`.
5663
- `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`.
6067
6168
# Usage.
6269
@@ -97,7 +104,7 @@ g = g |> gpu
97104
source, target = edge_index(g)
98105
```
99106
"""
100-
struct GNNGraph{T<:Union{COO_T,ADJMAT_T}}
107+
struct GNNGraph{T<:Union{COO_T,ADJMAT_T}} <: AbstractGraph{Int}
101108
graph::T
102109
num_nodes::Int
103110
num_edges::Int

0 commit comments

Comments
 (0)