Skip to content

Commit

Permalink
improved docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
ranocha committed Mar 6, 2019
1 parent 21a5f76 commit a73dd09
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/RootedTrees.jl
Expand Up @@ -3,7 +3,7 @@ module RootedTrees

using LinearAlgebra

import Base: show, isless, ==, iterate
import Base: show, isless, ==, iterate, copy


export RootedTree, RootedTreeIterator
Expand Down Expand Up @@ -35,6 +35,8 @@ function RootedTree(level_sequence::AbstractVector)
end
#TODO: Validate rooted tree in constructor?

copy(t::RootedTree) = RootedTree(copy(t.level_sequence))


# #function RootedTree(sequence::Vector{T}, valid::Bool)
# function RootedTree(sequence::Array{T,1})
Expand Down Expand Up @@ -114,15 +116,17 @@ Returns a new tree using the canonical representation of the rooted tree `t`,
i.e. the one with lexicographically biggest level sequence.
"""
function canonical_representation(t::RootedTree)
canonical_representation!(RootedTree(copy(t.level_sequence)))
canonical_representation!(copy(t))
end



"""
RootedTreeIterator{T<:Integer}
Iterator over all rooted trees of given `order`.
Iterator over all rooted trees of given `order`. The returned trees are views to
an internal tree modified during the iteration. If the returned trees shall be
stored or modified during the iteration, a `copy` has to be made.
"""
struct RootedTreeIterator{T<:Integer}
order::T
Expand Down

0 comments on commit a73dd09

Please sign in to comment.