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

StackOverflow #46

Closed
jtrakk opened this issue Dec 7, 2021 · 1 comment · Fixed by #34
Closed

StackOverflow #46

jtrakk opened this issue Dec 7, 2021 · 1 comment · Fixed by #34

Comments

@jtrakk
Copy link

jtrakk commented Dec 7, 2021

This code has a stack overflow.

julia> Buchheim()(random_regular_digraph(20, 10))
ERROR: LoadError: StackOverflowError:
Stacktrace:
 [1] findall(testf::Function, A::Vector{Int64})
   @ Base ./array.jl:2257
 [2] parent
   @ ~/.julia/packages/NetworkLayout/ObipC/src/buchheim.jl:88 [inlined]
 [3] first_walk(v::Int64, t::NetworkLayout.Tree{Vector{Vector{Int64}}, Vector{GeometryBasics.Point2{Float64}}, Vector{Float64}})
   @ NetworkLayout ~/.julia/packages/NetworkLayout/ObipC/src/buchheim.jl:101
 [4] first_walk(v::Int64, t::NetworkLayout.Tree{Vector{Vector{Int64}}, Vector{GeometryBasics.Point2{Float64}}, Vector{Float64}}) (repeats 14390 times)
   @ NetworkLayout ~/.julia/packages/NetworkLayout/ObipC/src/buchheim.jl:116
 [5] layout(para::NetworkLayout.Buchheim{Float64, Float64}, adj_list::Vector{Vector{Int64}})
   @ NetworkLayout ~/.julia/packages/NetworkLayout/ObipC/src/buchheim.jl:80
 [6] layout(para::NetworkLayout.Buchheim{Float64, Float64}, adj_matrix::SparseArrays.SparseMatrixCSC{Int64, Int64})
   @ NetworkLayout ~/.julia/packages/NetworkLayout/ObipC/src/buchheim.jl:69
 [7] layout
   @ ~/.julia/packages/NetworkLayout/ObipC/src/NetworkLayout.jl:99 [inlined]
 [8] (::NetworkLayout.Buchheim{Float64, Float64})(adj_matrix::Graphs.SimpleGraphs.SimpleDiGraph{Int64})
   @ NetworkLayout ~/.julia/packages/NetworkLayout/ObipC/src/NetworkLayout.jl:34
 [9] top-level scope
@hexaeder
Copy link
Collaborator

hexaeder commented Dec 7, 2021

Yeah similar to #7, this is because Buchheim algorithm works for rooted trees only. A regular digraph isn't a tree at all so the code should error but not with stack overflow. This will be closed by #34, thanks for reminding me of this PR!

@hexaeder hexaeder linked a pull request Dec 7, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants