Skip to content

Commit ce66be5

Browse files
committed
JuliaFormatter
1 parent 0153724 commit ce66be5

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

src/connectivity.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ julia> is_connected(g)
135135
true
136136
```
137137
"""
138-
function is_connected(g::AbstractGraph{T}) where T
138+
function is_connected(g::AbstractGraph{T}) where {T}
139139
mult = is_directed(g) ? 2 : 1
140140
if mult * ne(g) + 1 >= nv(g)
141141
label = zeros(T, nv(g))
@@ -180,15 +180,15 @@ function count_connected_components(
180180
g::AbstractGraph{T},
181181
label::AbstractVector{T}=zeros(T, nv(g)),
182182
search_queue::Vector{T}=Vector{T}();
183-
reset_label::Bool=false
184-
) where T
183+
reset_label::Bool=false,
184+
) where {T}
185185
connected_components!(label, g, search_queue)
186186
c = count_unique(label)
187187
reset_label && fill!(label, zero(eltype(label)))
188188
return c
189189
end
190190

191-
function count_unique(label::Vector{T}) where T
191+
function count_unique(label::Vector{T}) where {T}
192192
seen = Set{T}()
193193
c = 0
194194
for l in label

test/spanningtrees/boruvka.jl

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,18 @@
2121
g1t = GenericGraph(SimpleGraph(edges1))
2222
@test res1.weight == cost_mst
2323
# acyclic graphs have n - c edges
24-
@test nv(g1t) - ne(g1t) == length(connected_components(g1t)) == count_connected_components(g1t)
24+
@test nv(g1t) - ne(g1t) ==
25+
length(connected_components(g1t)) ==
26+
count_connected_components(g1t)
2527
@test nv(g1t) == nv(g)
2628

2729
res2 = boruvka_mst(g, distmx; minimize=false)
2830
edges2 = [Edge(src(e), dst(e)) for e in res2.mst]
2931
g2t = GenericGraph(SimpleGraph(edges2))
3032
@test res2.weight == cost_max_vec_mst
31-
@test nv(g2t) - ne(g2t) == length(connected_components(g2t)) == count_connected_components(g2t)
33+
@test nv(g2t) - ne(g2t) ==
34+
length(connected_components(g2t)) ==
35+
count_connected_components(g2t)
3236
@test nv(g2t) == nv(g)
3337
end
3438
# second test
@@ -60,14 +64,18 @@
6064
edges3 = [Edge(src(e), dst(e)) for e in res3.mst]
6165
g3t = GenericGraph(SimpleGraph(edges3))
6266
@test res3.weight == weight_vec2
63-
@test nv(g3t) - ne(g3t) == length(connected_components(g3t)) == count_connected_components(g3t)
67+
@test nv(g3t) - ne(g3t) ==
68+
length(connected_components(g3t)) ==
69+
count_connected_components(g3t)
6470
@test nv(g3t) == nv(gx)
6571

6672
res4 = boruvka_mst(g, distmx_sec; minimize=false)
6773
edges4 = [Edge(src(e), dst(e)) for e in res4.mst]
6874
g4t = GenericGraph(SimpleGraph(edges4))
6975
@test res4.weight == weight_max_vec2
70-
@test nv(g4t) - ne(g4t) == length(connected_components(g4t)) == count_connected_components(g4t)
76+
@test nv(g4t) - ne(g4t) ==
77+
length(connected_components(g4t)) ==
78+
count_connected_components(g4t)
7179
@test nv(g4t) == nv(gx)
7280
end
7381

@@ -123,14 +131,18 @@
123131
edges5 = [Edge(src(e), dst(e)) for e in res5.mst]
124132
g5t = GenericGraph(SimpleGraph(edges5))
125133
@test res5.weight == weight_vec3
126-
@test nv(g5t) - ne(g5t) == length(connected_components(g5t)) == count_connected_components(g5t)
134+
@test nv(g5t) - ne(g5t) ==
135+
length(connected_components(g5t)) ==
136+
count_connected_components(g5t)
127137
@test nv(g5t) == nv(gd)
128138

129139
res6 = boruvka_mst(g, distmx_third; minimize=false)
130140
edges6 = [Edge(src(e), dst(e)) for e in res6.mst]
131141
g6t = GenericGraph(SimpleGraph(edges6))
132142
@test res6.weight == weight_max_vec3
133-
@test nv(g6t) - ne(g6t) == length(connected_components(g6t)) == count_connected_components(g6t)
143+
@test nv(g6t) - ne(g6t) ==
144+
length(connected_components(g6t)) ==
145+
count_connected_components(g6t)
134146
@test nv(g6t) == nv(gd)
135147
end
136148
end

0 commit comments

Comments
 (0)