Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

[BUG] random_configuration_model(n::T, ks::Vector{T}) fails when {T} is not {Int64} #1577

Open
tlcz opened this issue Jul 20, 2021 · 0 comments
Labels
bug confirmed bug producing incorrect results

Comments

@tlcz
Copy link

tlcz commented Jul 20, 2021

Description of bug
call to random_configuration_model(n::Int32, ks::Vector{Int32}) fails with exception:

ERROR: MethodError: Cannot `convert` an object of type 
  LightGraphs.SimpleGraphs.SimpleEdge{Int64} to an object of type 
  LightGraphs.SimpleGraphs.SimpleEdge{Int32}
Closest candidates are:
  convert(::Type{T}, ::T) where T at essentials.jl:205
  LightGraphs.SimpleGraphs.SimpleEdge{T}(::LightGraphs.SimpleGraphs.AbstractSimpleEdge) where T<:Integer at /home/tomek/.julia/packages/LightGraphs/IgJif/src/SimpleGraphs/simpleedge.jl:29
  LightGraphs.SimpleGraphs.SimpleEdge{T}(::Any, ::Any) where T<:Integer at /home/tomek/.julia/packages/LightGraphs/IgJif/src/SimpleGraphs/simpleedge.jl:7
Stacktrace:
 [1] setindex!(h::Dict{LightGraphs.SimpleGraphs.SimpleEdge{Int32}, Nothing}, v0::Nothing, key0::LightGraphs.SimpleGraphs.SimpleEdge{Int64})
   @ Base ./dict.jl:374
 [2] push!(s::Set{LightGraphs.SimpleGraphs.SimpleEdge{Int32}}, x::LightGraphs.SimpleGraphs.SimpleEdge{Int64})
   @ Base ./set.jl:57
 [3] _try_creation(n::Int32, k::Vector{Int32}, rng::Random._GLOBAL_RNG)
   @ LightGraphs.SimpleGraphs ~/.julia/packages/LightGraphs/IgJif/src/SimpleGraphs/generators/randgraphs.jl:308
 [4] random_configuration_model(n::Int32, k::Vector{Int32}; seed::Int64, check_graphical::Bool)
   @ LightGraphs.SimpleGraphs ~/.julia/packages/LightGraphs/IgJif/src/SimpleGraphs/generators/randgraphs.jl:736
 [5] random_configuration_model(n::Int32, k::Vector{Int32})
   @ LightGraphs.SimpleGraphs ~/.julia/packages/LightGraphs/IgJif/src/SimpleGraphs/generators/randgraphs.jl:727
 [6] top-level scope
   @ ./timing.jl:210 [inlined]
 [7] top-level scope
   @ ./REPL[4]:0

How to reproduce

julia> using LightGraphs
julia> n = Int32(1e6);
julia> ks = rand(Base.OneTo(Int32(20)),n);
julia> g = random_configuration_model(n, ks)

Expected behavior
Describe what you expected to happen.

Actual behavior
Describe what actually happened.

Code demonstrating bug
If applicable, provide a minimal working example of the bug.

Version information

  • output from versioninfo() surrounded by backticks (``)
Julia Version 1.6.1
Commit 6aaedecc44 (2021-04-23 05:59 UTC)
Platform Info:
 OS: Linux (x86_64-pc-linux-gnu)
 CPU: Intel(R) Core(TM) i5-9300H CPU @ 2.40GHz
 WORD_SIZE: 64
 LIBM: libopenlibm
 LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
  • output from ] status LightGraphs surrounded by backticks (``)
(@v1.6) pkg> status LightGraphs
      Status `~/.julia/environments/v1.6/Project.toml`
  [093fc24a] LightGraphs v1.3.5

Additional context
Add any other context about the problem here.

@tlcz tlcz added the bug confirmed bug producing incorrect results label Jul 20, 2021
tlcz added a commit to tlcz/LightGraphs.jl that referenced this issue Jul 20, 2021
@tlcz tlcz changed the title [BUG] random_configuration_model(n::Int32, ks::Vector{Int32}) fails [BUG] random_configuration_model(n::T, ks::Vector{T}) fails when {T} is not {Int64} Jul 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug confirmed bug producing incorrect results
Projects
None yet
Development

No branches or pull requests

1 participant