@@ -182,7 +182,7 @@ function Graphs.degree(g::GNNGraph{<:ADJMAT_T}, T=nothing; dir=:out, edge_weight
182
182
vec (sum (A, dims= 1 )) .+ vec (sum (A, dims= 2 ))
183
183
end
184
184
185
- function Graphs. laplacian_matrix (g:: GNNGraph , T= nothing ; dir:: Symbol = :out )
185
+ function Graphs. laplacian_matrix (g:: GNNGraph , T:: DataType = Float32 ; dir:: Symbol = :out )
186
186
A = adjacency_matrix (g, T; dir= dir)
187
187
D = Diagonal (vec (sum (A; dims= 2 )))
188
188
return D - A
@@ -201,13 +201,13 @@ Normalized Laplacian matrix of graph `g`.
201
201
- `add_self_loops`: add self-loops while calculating the matrix.
202
202
- `dir`: the edge directionality considered (:out, :in, :both).
203
203
"""
204
- function normalized_laplacian (g:: GNNGraph , T= nodetype (g) ;
204
+ function normalized_laplacian (g:: GNNGraph , T:: DataType = Float32 ;
205
205
add_self_loops:: Bool = false , dir:: Symbol = :out )
206
206
à = normalized_adjacency (g, T; dir, add_self_loops)
207
207
return I - Ã
208
208
end
209
209
210
- function normalized_adjacency (g:: GNNGraph , T= nodetype (g) ;
210
+ function normalized_adjacency (g:: GNNGraph , T:: DataType = Float32 ;
211
211
add_self_loops:: Bool = false , dir:: Symbol = :out )
212
212
A = adjacency_matrix (g, T; dir= dir)
213
213
if add_self_loops
@@ -230,7 +230,7 @@ defined as ``\hat{L} = \frac{2}{\lambda_{max}} L - I`` where ``L`` is the normal
230
230
- `T`: result element type.
231
231
- `dir`: the edge directionality considered (:out, :in, :both).
232
232
"""
233
- function scaled_laplacian (g:: GNNGraph , T= nothing ; dir= :out )
233
+ function scaled_laplacian (g:: GNNGraph , T:: DataType = Float32 ; dir= :out )
234
234
L = normalized_laplacian (g, T)
235
235
@assert issymmetric (L) " scaled_laplacian only works with symmetric matrices"
236
236
λmax = _eigmax (L)
0 commit comments