File tree 1 file changed +9
-10
lines changed
1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -232,16 +232,15 @@ function adjsort(elems::AbstractVector{<:Connectivity})
232
232
found = false
233
233
vinds = last (adjs)
234
234
for i:: Int in vinds
235
- einds = findall (e -> i ∈ e, list)
236
- if ! isempty (einds)
237
- # lookup all elements that share at
238
- # least two vertices (i.e. edge)
239
- for j in sort (einds, rev= true )
240
- if length (vinds ∩ list[j]) > 1
241
- found = true
242
- push! (adjs, popat! (list, j))
243
- end
244
- end
235
+ not_i = (filter (!= (i), vinds)... ,)
236
+ for j in reverse (eachindex (list))
237
+ # equivalent to `length(vinds ∩ list[j]) > 1` but more efficient (no allocs(?))
238
+ any (== (i), list[j]) || continue
239
+ isdisjoint (not_i, list[j]) && continue
240
+
241
+ # implicitly `list[j]` contains `i` and at least one other vertex
242
+ found = true
243
+ push! (adjs, popat! (list, j))
245
244
end
246
245
end
247
246
You can’t perform that action at this time.
0 commit comments