Skip to content

VSCode warnings #423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions benchmark/serial/edges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ const P = Pair{Int,Int}
convert(::Type{Tuple}, e::Pair) = (e.first, e.second)

function fille(n)
t = Vector{Graphs.Edge}(undef, n)
for i in 1:n
t[i] = Graphs.Edge(i, i + 1)
end
return t
return [Graphs.Edge(i, i + 1) for i in 1:n]
end

function fillp(n)
Expand All @@ -22,8 +18,8 @@ end

function tsum(t)
x = 0
for i in 1:length(t)
u, v = Tuple(t[i])
for item in t
u, v = Tuple(item)
x += u
x += v
end
Expand Down
4 changes: 2 additions & 2 deletions src/Experimental/vf2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,10 @@ function vf2check_feasibility(
vf2rule_self_loops(u, v, state, problemtype)
syntactic_feasability || return false

if vertex_relation != nothing
if !isnothing(vertex_relation)
vertex_relation(u, v) || return false
end
if edge_relation != nothing
if !isnothing(edge_relation)
E1 = edgetype(state.g1)
E2 = edgetype(state.g2)
for u2 in outneighbors(state.g1, u)
Expand Down
2 changes: 1 addition & 1 deletion src/SimpleGraphs/simpledigraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ function _SimpleDiGraphFromIterator(iter)::SimpleDiGraph
fadjlist = Vector{Vector{T}}()
badjlist = Vector{Vector{T}}()

while next != nothing
while !isnothing(next)
(e, state) = next

if !(e isa E)
Expand Down
2 changes: 1 addition & 1 deletion src/SimpleGraphs/simplegraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ function _SimpleGraphFromIterator(iter)::SimpleGraph
g = SimpleGraph{T}()
fadjlist = Vector{Vector{T}}()

while next != nothing
while !isnothing(next)
(e, state) = next

if !(e isa E)
Expand Down
2 changes: 1 addition & 1 deletion src/cycles/basis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function cycle_basis(g::AbstractGraph, root=nothing)
nv(g) == 0 && return cycles

gnodes = Set(vertices(g))
r::T = (root == nothing) ? pop!(gnodes) : T(root)
r::T = isnothing(root) ? pop!(gnodes) : T(root)
while true
stack = [r]
pred = Dict(r => r)
Expand Down
2 changes: 1 addition & 1 deletion src/dominatingset/minimal_dom_set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function dominating_set(
# Check if any vertex is depending on v to be dominated
dependent = findfirst(u -> !in_dom_set[u] && dom_degree[u] <= 1, neighbors(g, v))

(dependent != nothing) && continue
!isnothing(dependent) && continue
in_dom_set[v] = false
length_ds -= 1
dom_degree[neighbors(g, v)] .-= 1
Expand Down
16 changes: 8 additions & 8 deletions test/experimental/isomorphism.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,32 +84,32 @@ cubic_graphs = [
cubic_graphs_perm = []

rng = StableRNG(1)
for i in 1:length(cubic_graphs)
push!(cubic_graphs_perm, shuffle_vertices(cubic_graphs[i], randperm(rng, 8)))
for graph in cubic_graphs
push!(cubic_graphs_perm, shuffle_vertices(graph, randperm(rng, 8)))
end

@testset "Isomorphism" begin
@test has_isomorph(grid([2, 3]), grid([3, 2]))

# the cubic graphs should only be isomorph to themself
# the cubic graphs should only be isomorphic to themselves
# the same holds for subgraph isomorphism and induced subgraph isomorphism
for i in 1:length(cubic_graphs), j in 1:length(cubic_graphs)
for i in eachindex(cubic_graphs), j in eachindex(cubic_graphs)
@test (i == j) == has_isomorph(cubic_graphs[i], cubic_graphs[j])
@test (i == j) == has_subgraphisomorph(cubic_graphs[i], cubic_graphs[j])
@test (i == j) == has_induced_subgraphisomorph(cubic_graphs[i], cubic_graphs[j])
end

# the cubic graphs should only be isomorph a permutation of themself
# the cubic graphs should only be isomorphic to a permutation of themselves
# the same holds for subgraph isomorphism and induced subgraph isomorphism
for i in 1:length(cubic_graphs), j in 1:length(cubic_graphs_perm)
for i in eachindex(cubic_graphs), j in eachindex(cubic_graphs_perm)
@test (i == j) == has_isomorph(cubic_graphs[i], cubic_graphs_perm[j])
@test (i == j) == has_subgraphisomorph(cubic_graphs[i], cubic_graphs_perm[j])
@test (i == j) ==
has_induced_subgraphisomorph(cubic_graphs[i], cubic_graphs_perm[j])
end

# count_isomorph, count_subgraphisomorph and count_induced_subgraphisomorph are commutative
for i in 1:length(cubic_graphs)
for i in eachindex(cubic_graphs)
g1 = cubic_graphs[i]
g2 = cubic_graphs_perm[i]
@test count_isomorph(g1, g1) ==
Expand All @@ -126,7 +126,7 @@ end
count_subgraphisomorph(g2, g2)
end

for i in 1:length(cubic_graphs)
for i in eachindex(cubic_graphs)
g1 = cubic_graphs[i]
g2 = cubic_graphs_perm[i]
length(collect(all_isomorph(g1, g1))) == count_isomorph(g1, g2)
Expand Down
2 changes: 1 addition & 1 deletion test/linalg/graphmatrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ using ArnoldiMethod: LM, SR, LR, partialschur, partialeigen
abs(l1 - 1) < 1e-8 || error("failed to compute stationary distribution") # TODO 0.7: should we change the error type to InexactError?
p = real(er[2][:, 1])
if p[1] < 0
for i in 1:length(p)
for i in eachindex(p)
p[i] = -p[i]
end
end
Expand Down
Loading