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

Documentation changes #13

Merged
merged 1 commit into from
Oct 17, 2020
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
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ many breaking changes in the near future.

### Construction

`RootedTree`s are represented using level sequences, i.e. `AbstractVector`s
`RootedTree`s are represented using level sequences, i.e., `AbstractVector`s
containing the distances of the nodes from the root, cf.
Beyer, Terry, and Sandra Mitchell Hedetniemi.
"Constant time generation of rooted trees."
Expand All @@ -28,7 +28,7 @@ RootedTree{Int64}: [1, 2, 3, 2]
```
In the notation of [Butcher (Numerical Methods for ODEs, 2016)](https://doi.org/10.1002/9781119121534),
this tree can be written as `[[τ²] τ]` or `(τ ∘ τ) ∘ (τ ∘ τ)`, where
`∘` is the non-asociative Butcher product of `RootedTree`s, which is also
`∘` is the non-associative Butcher product of `RootedTree`s, which is also
implemented.

To get the representation of a `RootedTree` introduced by Butcher, use `butcher_representation`:
Expand All @@ -46,7 +46,7 @@ A `RootedTreeIterator(order::Integer)` can be used to iterate efficiently
over all `RootedTree`s of a given `order`.

Be careful that the iterator is stateful for efficiency reasons, so you might
need to use `copy` appropriately, e.g.
need to use `copy` appropriately, e.g.,
```julia
julia> map(identity, RootedTreeIterator(4))
4-element Array{RootedTrees.RootedTree{Int64,Array{Int64,1}},1}:
Expand All @@ -67,11 +67,11 @@ julia> map(copy, RootedTreeIterator(4))

The usual functions on `RootedTree`s are implemented, cf.
[Butcher (Numerical Methods for ODEs, 2016)](https://doi.org/10.1002/9781119121534).
- `order(t::RootedTree)`: The order of a `RootedTree`, i.e. the length of it's level sequence.
- `σ(t::RootedTree)`:The symmetry `σ` of a rooted tree, i.e. the order of the group of automorphisms on a particular labelling (of the vertices) of `t`.
- `γ(t::RootedTree)`: The density `γ(t)` of a rooted tree, i.e. the product over all vertices of `t` of the order of the subtree rooted at that vertex.
- `α(t::RootedTree)`: The number of monotonic labellings of `t` not equivalent under the symmetry group.
- `β(t::RootedTree)`: The total number of labellings of `t` not equivalent under the symmetry group.
- `order(t::RootedTree)`: The order of a `RootedTree`, i.e., the length of its level sequence.
- `σ(t::RootedTree)`: The symmetry `σ` of a rooted tree, i.e., the order of the group of automorphisms on a particular labelling (of the vertices) of `t`.
- `γ(t::RootedTree)`: The density `γ(t)` of a rooted tree, i.e., the product over all vertices of `t` of the order of the subtree rooted at that vertex.
- `α(t::RootedTree)`: The number of monotonic labelings of `t` not equivalent under the symmetry group.
- `β(t::RootedTree)`: The total number of labelings of `t` not equivalent under the symmetry group.

Additionally, functions on trees connected to Runge-Kutta methods are implemented.
- `elementary_weight(t, A, b, c)`: Compute the elementary weight Φ(`t`) of `t::RootedTree` for the Butcher coefficients `A, b, c` of a Runge-Kutta method.
Expand Down
22 changes: 11 additions & 11 deletions src/RootedTrees.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ copy(t::RootedTree) = RootedTree(copy(t.level_sequence), t.iscanonical)
# # # Test, whether there is exactly one root element at the beginning of sequence, if necessary.
# # root = sequence[1]
# # for level in sequence[2:end]
# # level <= root && throw(ArgumentError("Rooted trees must have exactly one element at root-level at the beginning."))
# # level <= root && throw(ArgumentError("Rooted trees must have exactly one element at root level at the beginning."))
# # end
# #end
# # If there is only one element, the sequence must be valid.
# if length(sequence) > 1
# # Test, whether there is exactly one root element at the beginning of sequence, if necessary.
# root = sequence[1]
# for level in sequence[2:end]
# level <= root && throw(ArgumentError("Rooted trees must have exactly one element at root-level at the beginning."))
# level <= root && throw(ArgumentError("Rooted trees must have exactly one element at root level at the beginning."))
# end
# end
#
Expand Down Expand Up @@ -109,7 +109,7 @@ end
"""
canonical_representation!(t::RootedTree)

Change the representation of the rooted tree `t` to the canonical one, i.e. the
Change the representation of the rooted tree `t` to the canonical one, i.e., the
one with lexicographically biggest level sequence.
"""
function canonical_representation!(t::RootedTree)
Expand All @@ -133,7 +133,7 @@ end
canonical_representation(t::RootedTree)

Returns a new tree using the canonical representation of the rooted tree `t`,
i.e. the one with lexicographically biggest level sequence.
i.e., the one with lexicographically biggest level sequence.
"""
function canonical_representation(t::RootedTree)
canonical_representation!(copy(t))
Expand Down Expand Up @@ -271,15 +271,15 @@ end
"""
order(t::RootedTree)

The `order` of a rooted tree, i.e. the length of it's level sequence.
The `order` of a rooted tree, i.e., the length of its level sequence.
"""
order(t::RootedTree) = length(t.level_sequence)


"""
σ(t::RootedTree)

The symmetry `σ` of a rooted tree `t`, i.e. the order of the group of automorphisms
The symmetry `σ` of a rooted tree `t`, i.e., the order of the group of automorphisms
on a particular labelling (of the vertices) of `t`.

Reference: Section 301 of
Expand Down Expand Up @@ -315,7 +315,7 @@ end
"""
γ(t::RootedTree)

The density `γ(t)` of a rooted tree, i.e. the product over all vertices of `t`
The density `γ(t)` of a rooted tree, i.e., the product over all vertices of `t`
of the order of the subtree rooted at that vertex.

Reference: Section 301 of
Expand All @@ -342,7 +342,7 @@ end
"""
α(t::RootedTree)

The number of monotonic labellings of `t` not equivalent under the symmetry group.
The number of monotonic labelings of `t` not equivalent under the symmetry group.

Reference: Section 302 of
Butcher, John Charles.
Expand All @@ -357,7 +357,7 @@ end
"""
β(t::RootedTree)

The total number of labellings of `t` not equivalent under the symmetry group.
The total number of labelings of `t` not equivalent under the symmetry group.

Reference: Section 302 of
Butcher, John Charles.
Expand Down Expand Up @@ -480,9 +480,9 @@ function butcher_representation(t::RootedTree)
end
result = "[" * result * "]"

# normalise the result by grouping repeated occurences of τ
# normalize the result by grouping repeated occurrences of τ
# TODO: Decide whether powers should also be used for subtrees,
# e.g. "[[τ]²]" instead of "[[τ][τ]]"
# e.g., "[[τ]²]" instead of "[[τ][τ]]"
# for rootedtree([1, 2, 3, 2, 3]).
# Currently, powers are only used for τ.
for n in order(t):-1:2
Expand Down