Skip to content

Commit 5878e7b

Browse files
authored
Fix formatting for file vf2.jl and remove ignore in test (#323)
1 parent 34b44d0 commit 5878e7b

File tree

26 files changed

+141
-73
lines changed

26 files changed

+141
-73
lines changed

benchmark/core.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ end
3434

3535
suite["core"]["has_edge"] = BenchmarkGroup(["graphs", "digraphs"])
3636
suite["core"]["has_edge"]["graphs"] = @benchmarkable [all_has_edge(g) for (n, g) in $GRAPHS]
37-
suite["core"]["has_edge"]["digraphs"] = @benchmarkable [all_has_edge(g) for (n, g) in $DIGRAPHS]
37+
suite["core"]["has_edge"]["digraphs"] = @benchmarkable [
38+
all_has_edge(g) for (n, g) in $DIGRAPHS
39+
]

src/Experimental/vf2.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ function all_isomorph(
658658
edge_relation::Union{Nothing,Function}=nothing,
659659
)::Channel{Vector{Tuple{eltype(g1),eltype(g2)}}}
660660
T = Vector{Tuple{eltype(g1),eltype(g2)}}
661-
!could_have_isomorph(g1, g2) && return Channel(_ -> nothing, ctype = T) # TODO: fix problem with JuliaFormatter, right now the whole file is ignored
661+
!could_have_isomorph(g1, g2) && return Channel(_ -> nothing, ctype = T)
662662
make_callback(c) = vmap -> (put!(c, collect(zip(vmap, 1:length(vmap)))), return true)
663663
ch::Channel{T} = Channel(; ctype=T) do c
664664
vf2(

src/Parallel/centrality/stress.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ function threaded_stress_centrality(g::AbstractGraph, vs=vertices(g))::Vector{In
5252
@sync for (t, task_range) in enumerate(Iterators.partition(1:k, task_size))
5353
Threads.@spawn for s in @view(vs[task_range])
5454
if degree(g, s) > 0 # this might be 1?
55-
state = Graphs.dijkstra_shortest_paths(g, s; allpaths=true, trackvertices=true)
55+
state = Graphs.dijkstra_shortest_paths(
56+
g, s; allpaths=true, trackvertices=true
57+
)
5658
Graphs._stress_accumulate_basic!(local_stress[t], state, g, s)
5759
end
5860
end

src/SimpleGraphs/generators/randgraphs.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,9 @@ function newman_watts_strogatz(
443443
rng::Union{Nothing,AbstractRNG}=nothing,
444444
seed::Union{Nothing,Integer}=nothing,
445445
)
446-
return watts_strogatz(n, k, β; is_directed=is_directed, remove_edges=false, rng=rng, seed=seed)
446+
return watts_strogatz(
447+
n, k, β; is_directed=is_directed, remove_edges=false, rng=rng, seed=seed
448+
)
447449
end
448450

449451
function _suitable(edges::Set{SimpleEdge{T}}, potential_edges::Dict{T,T}) where {T<:Integer}

src/SimpleGraphs/simpleedge.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ function ==(e1::AbstractSimpleEdge, e2::AbstractSimpleEdge)
3434
return (src(e1) == src(e2) && dst(e1) == dst(e2))
3535
end
3636
hash(e::AbstractSimpleEdge, h::UInt) = hash(src(e), hash(dst(e), h))
37-
isless(e1::AbstractSimpleEdge, e2::AbstractSimpleEdge) = (src(e1) < src(e2)) || ((src(e1) == src(e2)) && (dst(e1) < dst(e2)))
37+
function isless(e1::AbstractSimpleEdge, e2::AbstractSimpleEdge)
38+
return (src(e1) < src(e2)) || ((src(e1) == src(e2)) && (dst(e1) < dst(e2)))
39+
end

src/centrality/stress.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ function stress_centrality(
5151
rng::Union{Nothing,AbstractRNG}=nothing,
5252
seed::Union{Nothing,Integer}=nothing,
5353
)
54-
return stress_centrality(g, sample(collect_if_not_vector(vertices(g)), k; rng=rng, seed=seed))
54+
return stress_centrality(
55+
g, sample(collect_if_not_vector(vertices(g)), k; rng=rng, seed=seed)
56+
)
5557
end
5658

5759
function _stress_accumulate_basic!(

src/core.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ end
136136

137137
degree(g::AbstractGraph, vs=vertices(g)) = [degree(g, x) for x in vs]
138138

139-
140139
"""
141140
Δout(g)
142141

src/graphcut/normalized_cut.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ end
118118
function _recursive_normalized_cut(W, thres, num_cuts)
119119
m, n = size(W)
120120
(m <= 1) && return ones(Int, m) # trivial
121-
D = Diagonal(vec(sum(W, dims=2)))
121+
D = Diagonal(vec(sum(W; dims=2)))
122122

123123
# check that the diagonal is not degenerated as otherwise invDroot errors
124124
dnz = abs.(diag(D)) .>= 1E-16
@@ -137,7 +137,7 @@ function _recursive_normalized_cut(W, thres, num_cuts)
137137
# At least some versions of ARPACK have a bug, this is a workaround
138138
invDroot = sqrt.(inv(D)) # equal to Cholesky factorization for diagonal D
139139
if n > 12
140-
_, Q = eigs(invDroot' * (D - W) * invDroot, nev=12, which=SR())
140+
_, Q = eigs(invDroot' * (D - W) * invDroot; nev=12, which=SR())
141141
(size(Q, 2) <= 1) && return collect(1:m) # no 2nd eigenvector
142142
ret = convert(Vector, real(view(Q, :, 2)))
143143
else
@@ -149,7 +149,7 @@ function _recursive_normalized_cut(W, thres, num_cuts)
149149
min_cost = Inf
150150
best_thres = -1
151151
vmin, vmax = extrema(v)
152-
for t in range(vmin, stop=vmax, length=num_cuts)
152+
for t in range(vmin; stop=vmax, length=num_cuts)
153153
cut = v .> t
154154
cost = _normalized_cut_cost(cut, W, D)
155155
if cost < min_cost

src/linalg/LinAlg.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function eigs(A; kwargs...)
5252
vals, vectors = partialeigen(schr[1])
5353
reved = (kwargs[:which] == LR() || kwargs[:which] == LM())
5454
k = min(get(kwargs, :nev, length(vals))::Int, length(vals))
55-
perm = sortperm(vals, by=real, rev=reved)[1:k]
55+
perm = sortperm(vals; by=real, rev=reved)[1:k]
5656
λ = vals[perm]
5757
Q = vectors[:, perm]
5858
return λ, Q

src/traversals/dfs.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ end
5353
end
5454
else
5555
pop!(vertex_stack)
56-
if vcolor[u] == 1
56+
if vcolor[u] == 1
5757
vcolor[u] = 2
5858
end
5959
end
@@ -107,10 +107,10 @@ function topological_sort_by_dfs end
107107
push!(vertex_stack, n)
108108
end
109109
end
110-
else
110+
else
111111
pop!(vertex_stack)
112112
# if vcolor[u] == 2, the vertex was already explored and added to verts
113-
if vcolor[u] == 1
113+
if vcolor[u] == 1
114114
vcolor[u] = 2
115115
pushfirst!(verts, u)
116116
end

0 commit comments

Comments
 (0)