@@ -150,12 +150,13 @@ julia> k_core(g, 2)
150
150
2
151
151
3
152
152
4
153
- 5
153
+ 5
154
154
```
155
155
"""
156
156
function k_core (g:: AbstractGraph , k= - 1 ; corenum= core_number (g))
157
157
if (k == - 1 )
158
- k = maximum (corenum) # max core
158
+ # type assertion for inference (performance of captured variables julia#15726)
159
+ k:: Int = maximum (corenum) # max core
159
160
end
160
161
161
162
return findall (x -> x >= k, corenum)
@@ -210,15 +211,16 @@ julia> k_shell(g, 2)
210
211
"""
211
212
function k_shell (g:: AbstractGraph , k= - 1 ; corenum= core_number (g))
212
213
if k == - 1
213
- k = maximum (corenum)
214
+ # type assertion for inference (performance of captured variables julia#15726)
215
+ k:: Int = maximum (corenum)
214
216
end
215
217
return findall (x -> x == k, corenum)
216
218
end
217
219
218
220
"""
219
221
k_crust(g[, k]; corenum=core_number(g))
220
222
221
- Return a vector of vertices in the k-crust of `g`.
223
+ Return a vector of vertices in the k-crust of `g`.
222
224
If `k` is not specified, return the crust of the core with
223
225
the largest degree.
224
226
@@ -267,15 +269,16 @@ julia> k_crust(g, 2)
267
269
"""
268
270
function k_crust (g, k= - 1 ; corenum= core_number (g))
269
271
if k == - 1
270
- k = maximum (corenum) - 1
272
+ # type assertion for inference (performance of captured variables julia#15726)
273
+ k:: Int = maximum (corenum) - 1
271
274
end
272
275
return findall (x -> x <= k, corenum)
273
276
end
274
277
275
278
"""
276
279
k_corona(g, k; corenum=core_number(g))
277
280
278
- Return a vector of vertices in the k-corona of `g`.
281
+ Return a vector of vertices in the k-corona of `g`.
279
282
280
283
The k-corona is the subgraph of vertices in the [`k-core`](@ref k_core) which
281
284
have exactly `k` neighbors in the k-core.
0 commit comments