Skip to content
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

[BUG] steiner_tree fails if only one terminal vertex is passed #362

Closed
mtfishman opened this issue Apr 12, 2024 · 1 comment · Fixed by #368
Closed

[BUG] steiner_tree fails if only one terminal vertex is passed #362

mtfishman opened this issue Apr 12, 2024 · 1 comment · Fixed by #368
Labels
bug Something isn't working

Comments

@mtfishman
Copy link
Contributor

Description of bug
steiner_tree fails if only one terminal vertex is passed.

How to reproduce

julia> using Graphs

julia> steiner_tree(grid((2, 2)), [2])

Expected behavior
I was hoping/expecting it would output a graph with no edges and a number of vertices equal to the specified terminal vertex, i.e.:

julia> steiner_tree(grid((2, 2)), [2])
{2, 0} undirected simple Int64 graph

Actual behavior

julia> steiner_tree(grid((2, 2)), [2])
ERROR: InexactError: check_top_bit(UInt64, -1)
Stacktrace:
  [1] throw_inexacterror(f::Symbol, ::Type{UInt64}, val::Int64)
    @ Core ./boot.jl:634
  [2] check_top_bit
    @ ./boot.jl:648 [inlined]
  [3] toUInt64
    @ ./boot.jl:759 [inlined]
  [4] UInt64
    @ ./boot.jl:789 [inlined]
  [5] convert
    @ ./number.jl:7 [inlined]
  [6] cconvert
    @ ./essentials.jl:543 [inlined]
  [7] sizehint!
    @ ./array.jl:1351 [inlined]
  [8] kruskal_mst(::Type{SimpleTraits.Not{IsDirected{…}}}, g::SimpleGraph{Int64}, distmx::Graphs.DefaultDistance; minimize::Bool)
    @ Graphs ~/.julia/packages/Graphs/czpTe/src/spanningtrees/kruskal.jl:18
  [9] kruskal_mst
    @ ~/.julia/packages/Graphs/czpTe/src/spanningtrees/kruskal.jl:12 [inlined]
 [10] kruskal_mst
    @ ~/.julia/packages/SimpleTraits/l1ZsK/src/SimpleTraits.jl:338 [inlined]
 [11] steiner_tree(::Type{SimpleTraits.Not{…}}, g::SimpleGraph{Int64}, term_vert::Vector{Int64}, distmx::Graphs.DefaultDistance)
    @ Graphs ~/.julia/packages/Graphs/czpTe/src/steinertree/steiner_tree.jl:79
 [12] steiner_tree
    @ ~/.julia/packages/SimpleTraits/l1ZsK/src/SimpleTraits.jl:331 [inlined]
 [13] steiner_tree(g::SimpleGraph{Int64}, term_vert::Vector{Int64})
    @ Graphs ~/.julia/packages/SimpleTraits/l1ZsK/src/SimpleTraits.jl:331
 [14] top-level scope
    @ REPL[13]:1
Some type information was truncated. Use `show(err)` to see complete types.

Code demonstrating bug

julia> steiner_tree(grid((2, 2)), [2])

Version information

  • output from versioninfo() surrounded by backticks (``)
julia> versioninfo()
Julia Version 1.10.2
Commit bd47eca2c8a (2024-03-01 10:14 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 10 × Apple M1 Max
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
  • output from ] status Graphs surrounded by backticks (``)
  [86223c79] Graphs v1.10.0

Additional context
Add any other context about the problem here.

@mtfishman mtfishman added the bug Something isn't working label Apr 12, 2024
@mtfishman
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant