Skip to content

Commit a41fa39

Browse files
authored
fix CI: avoid JET.jl UndefVarError warnings (#463)
Rely on union-splitting instead.
1 parent 71365ed commit a41fa39

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

src/centrality/betweenness.jl

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -141,22 +141,15 @@ end
141141
function _rescale!(
142142
betweenness::Vector{Float64}, n::Integer, normalize::Bool, directed::Bool, k::Integer
143143
)
144+
scale = nothing
144145
if normalize
145-
if n <= 2
146-
do_scale = false
147-
else
148-
do_scale = true
146+
if 2 < n
149147
scale = 1.0 / ((n - 1) * (n - 2))
150148
end
151-
else
152-
if !directed
153-
do_scale = true
154-
scale = 1.0 / 2.0
155-
else
156-
do_scale = false
157-
end
149+
elseif !directed
150+
scale = 1.0 / 2.0
158151
end
159-
if do_scale
152+
if !isnothing(scale)
160153
if k > 0
161154
scale = scale * n / k
162155
end

src/persistence/lg.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,23 +58,23 @@ function _lg_skip_one_graph(f::IO, n_e::Integer)
5858
end
5959

6060
function _parse_header(s::AbstractString)
61-
addl_info = false
6261
nvstr, nestr, dirundir, graphname = split(s, r"s*,s*"; limit=4)
62+
addl = nothing
6363
if occursin(",", graphname) # version number and type
6464
graphname, _ver, _dtype, graphcode = split(graphname, r"s*,s*")
6565
ver = parse(Int, _ver)
6666
dtype = getfield(Main, Symbol(_dtype))
67-
addl_info = true
67+
addl = (ver, dtype, graphcode)
6868
end
6969
n_v = parse(Int, nvstr)
7070
n_e = parse(Int, nestr)
7171
dirundir = strip(dirundir)
7272
directed = !(dirundir == "u")
7373
graphname = strip(graphname)
74-
if !addl_info
74+
if addl === nothing
7575
header = LGHeader(n_v, n_e, directed, graphname)
7676
else
77-
header = LGHeader(n_v, n_e, directed, graphname, ver, dtype, graphcode)
77+
header = LGHeader(n_v, n_e, directed, graphname, addl...)
7878
end
7979
return header
8080
end

0 commit comments

Comments
 (0)