Skip to content

Commit de9fd7e

Browse files
committed
fix bug on tree partition
1 parent 30e650c commit de9fd7e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/Trees/abstracttree.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,16 @@ Given a `tree`, return a `partition` vector whose `i`-th entry stores all the no
9393
`tree` with `depth=i-1`. Empty nodes are not added to the partition.
9494
"""
9595
function partition_by_depth(tree)
96-
T = eltype(tree)
96+
T = typeof(tree)
9797
partition = Vector{Vector{T}}()
9898
depth = 0
9999
_partition_by_depth!(partition,tree,depth)
100100
end
101101

102102
function _partition_by_depth!(partition,tree,depth)
103-
T = eltype(tree)
103+
T = typeof(tree)
104104
if length(partition) < depth+1
105-
push!(partition,T[])
105+
push!(partition,[])
106106
end
107107
length(tree) > 0 && push!(partition[depth+1],tree)
108108
for chd in children(tree)

0 commit comments

Comments
 (0)