Skip to content
Merged
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
12 changes: 5 additions & 7 deletions src/RootedTrees.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ end
root = first(level_sequence)
prev = root
for level in view(level_sequence,
(firstindex(level_sequence) + 1):lastindex(level_sequence))
(firstindex(level_sequence) + 1):lastindex(level_sequence))
if (level <= root) || (level > prev + 1)
return false
end
Expand Down Expand Up @@ -905,7 +905,7 @@ function all_partitions(t::RootedTree)
forests = [partition_forest(t, edge_set)]
skeletons = [partition_skeleton(t, edge_set)]

for edge_set_value in 1:(2^length(edge_set) - 1)
for edge_set_value in 1:(2 ^ length(edge_set) - 1)
binary_digits!(edge_set, edge_set_value)
push!(forests, partition_forest(t, edge_set))
push!(skeletons, partition_skeleton(t, edge_set))
Expand Down Expand Up @@ -1056,10 +1056,8 @@ end

# necessary for simple and convenient use since the iterates may be modified
function Base.collect(partitions::PartitionIterator{TreeInput,
TreeOutput}) where {
TreeInput,
TreeOutput
}
TreeOutput}) where {TreeInput,
TreeOutput}
iterates = Vector{Tuple{Vector{TreeOutput}, TreeOutput}}()
sizehint!(iterates, length(partitions))
for (forest, skeleton) in partitions
Expand Down Expand Up @@ -1092,7 +1090,7 @@ function all_splittings(t::RootedTree)
forests = Vector{Vector{RootedTree{T, Vector{T}}}}()
subtrees = Vector{RootedTree{T, Vector{T}}}() # ordered subtrees

for node_set_value in 0:(2^order(t) - 1)
for node_set_value in 0:(2 ^ order(t) - 1)
binary_digits!(node_set, node_set_value)

# Check that if a node is removed then all of its descendants are removed
Expand Down
9 changes: 5 additions & 4 deletions src/colored_trees.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ Representation of bicolored rooted trees.

See also [`ColoredRootedTree`](@ref), [`RootedTree`](@ref), [`rootedtree`](@ref).
"""
const BicoloredRootedTree{T <: Integer, V <: AbstractVector{T}, C <: AbstractVector{Bool}} = ColoredRootedTree{T,
V,
C}
const BicoloredRootedTree{T <: Integer, V <: AbstractVector{T},
C <: AbstractVector{Bool}} = ColoredRootedTree{T,
V,
C}

"""
rootedtree(level_sequence, color_sequence)
Expand Down Expand Up @@ -204,7 +205,7 @@ function Base.:(==)(t1::ColoredRootedTree, t2::ColoredRootedTree)

root1_minus_root2 = first(t1.level_sequence) - first(t2.level_sequence)
for (e1, c1, e2, c2) in zip(t1.level_sequence, t1.color_sequence, t2.level_sequence,
t2.color_sequence)
t2.color_sequence)
v1 = e1
v2 = e2 + root1_minus_root2
(v1 == v2 && c1 == c2) || return false
Expand Down
14 changes: 8 additions & 6 deletions src/plot_recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ function _plot_coordinates(t::AbstractRootedTree,
x_child = x_children[idx]
push!(x, nan, x_root, x_child)
push!(y, nan, y_root, y_child)
x_recursive, y_recursive = _plot_coordinates(subtr[idx],
x_child, y_child, width / 3, height)
x_recursive,
y_recursive = _plot_coordinates(subtr[idx],
x_child, y_child, width / 3, height)
append!(x, x_recursive)
append!(y, y_recursive)
end
Expand Down Expand Up @@ -212,10 +213,11 @@ function _plot_coordinates(t::ColoredRootedTree,
push!(x, [x_root, x_child])
push!(y, [y_root, y_child])
push!(colors, [color_root, colormap[first(subtr[idx].color_sequence)]])
x_recursive, y_recursive, colors_recursive = _plot_coordinates(subtr[idx],
x_child, y_child,
width / 3, height,
colormap)
x_recursive, y_recursive,
colors_recursive = _plot_coordinates(subtr[idx],
x_child, y_child,
width / 3, height,
colormap)
append!(x, x_recursive)
append!(y, y_recursive)
append!(colors, colors_recursive)
Expand Down
Loading