@@ -262,9 +262,9 @@ or a vector.
262
262
- `g`: A graph.
263
263
- `T`: Element type of the returned vector. If `nothing`, is
264
264
chosen based on the graph type and will be an integer
265
- if `edge_weight= false`. Default `nothing`.
266
- - `dir`: For `dir= :out` the degree of a node is counted based on the outgoing edges.
267
- For `dir= :in`, the ingoing edges are used. If `dir= :both` we have the sum of the two.
265
+ if `edge_weight = false`. Default `nothing`.
266
+ - `dir`: For `dir = :out` the degree of a node is counted based on the outgoing edges.
267
+ For `dir = :in`, the ingoing edges are used. If `dir = :both` we have the sum of the two.
268
268
- `edge_weight`: If `true` and the graph contains weighted edges, the degree will
269
269
be weighted. Set to `false` instead to just count the number of
270
270
outgoing/ingoing edges.
@@ -326,20 +326,20 @@ given `edge_type`.
326
326
- `edge_type`: A tuple of symbols `(source_t, edge_t, target_t)` representing the edge type.
327
327
- `T`: Element type of the returned vector. If `nothing`, is
328
328
chosen based on the graph type. Default `nothing`.
329
- - `dir`: For `dir= :out` the degree of a node is counted based on the outgoing edges.
329
+ - `dir`: For `dir = :out` the degree of a node is counted based on the outgoing edges.
330
330
For `dir = :in`, the ingoing edges are used. If `dir = :both` we have the sum of the two.
331
331
Default `dir = :out`.
332
332
333
333
"""
334
- function Graphs. degree (g:: GNNHeteroGraph , edge:: Tuple{Symbol, Symbol, Symbol} ,
334
+ function Graphs. degree (g:: GNNHeteroGraph , edge:: EType ,
335
335
T:: TT = nothing ; dir = :out ) where {
336
336
TT <: Union{Nothing, Type{<:Number}} }
337
337
338
338
s, t = edge_index (g, edge)
339
339
340
340
T = isnothing (T) ? eltype (s) : T
341
341
342
- n_type = dir == :in ? g. ntypes[2 ] : g. ntypes[1 ]
342
+ n_type = dir == :in ? g. ntypes[2 ] : g. ntypes[1 ]
343
343
344
344
return _degree ((s, t), T, dir, nothing , g. num_nodes[n_type])
345
345
end
407
407
has_isolated_nodes(g::GNNGraph; dir=:out)
408
408
409
409
Return true if the graph `g` contains nodes with out-degree (if `dir=:out`)
410
- or in-degree (if `dir= :in`) equal to zero.
410
+ or in-degree (if `dir = :in`) equal to zero.
411
411
"""
412
412
function has_isolated_nodes (g:: GNNGraph ; dir = :out )
413
413
return any (iszero, degree (g; dir))
0 commit comments