RootedTrees.jl API
RootedTrees.RootedTrees — Module
RootedTrees
A collection of functionality around rooted trees to generate order conditions for Runge-Kutta methods in Julia. This package also provides basic functionality for BSeries.jl.
API Documentation
The API of RootedTrees.jl is documented in the following. Additional information on each function is available in their docstrings and in the online documentation.
Construction
RootedTrees are represented using level sequences, i.e., AbstractVectors containing the distances of the nodes from the root, see
- Beyer, Terry, and Sandra Mitchell Hedetniemi. "Constant time generation of rooted trees". SIAM Journal on Computing 9.4 (1980): 706-712. DOI: 10.1137/0209055
RootedTrees can be constructed from their level sequence using
julia> t = rootedtree([1, 2, 3, 2])
RootedTree{Int64}: [1, 2, 3, 2]In the notation of Butcher (Numerical Methods for ODEs, 2016), this tree can be written as [[τ] τ] or (τ ∘ τ) ∘ (τ ∘ τ), where ∘ is the non-associative Butcher product of RootedTrees, which is also implemented.
To get the representation of a RootedTree introduced by Butcher, use butcher_representation:
julia> t = rootedtree([1, 2, 3, 4, 3, 3, 2, 2, 2, 2, 2])
RootedTree{Int64}: [1, 2, 3, 4, 3, 3, 2, 2, 2, 2, 2]
julia> butcher_representation(t)
"[[[τ]τ²]τ⁵]"There are also some simple plot recipes for Plots.jl. Thus, you can visualize a rooted tree t using plot(t) when using Plots.
Additionally, there is an un-exported function RootedTrees.latexify that can generate LaTeX code for a rooted tree t based on the LaTeX package forest. The relevant code that needs to be included in the preamble can be obtained from the docstring of RootedTrees.latexify (type ? and RootedTrees.latexify in the Julia REPL). The same format is used when you are using Latexify and their function latexify, see Latexify.jl.
Iteration over RootedTrees
A RootedTreeIterator(order::Integer) can be used to iterate efficiently over all RootedTrees of a given order.
Be careful that the iterator is stateful for efficiency reasons, so you might need to use copy appropriately, e.g.,
julia> map(identity, RootedTreeIterator(4))
4-element Array{RootedTrees.RootedTree{Int64,Array{Int64,1}},1}:
RootedTree{Int64}: [1, 2, 2, 2]
RootedTree{Int64}: [1, 2, 2, 2]
RootedTree{Int64}: [1, 2, 2, 2]
RootedTree{Int64}: [1, 2, 2, 2]
julia> map(copy, RootedTreeIterator(4))
4-element Array{RootedTrees.RootedTree{Int64,Array{Int64,1}},1}:
RootedTree{Int64}: [1, 2, 3, 4]
RootedTree{Int64}: [1, 2, 3, 3]
RootedTree{Int64}: [1, 2, 3, 2]
RootedTree{Int64}: [1, 2, 2, 2]Functions on Trees
The usual functions on RootedTrees are implemented, cf. Butcher (Numerical Methods for ODEs, 2016).
order(t::RootedTree): The order of aRootedTree, i.e., the length of its level sequence.σ(t::RootedTree)orsymmetry(t): The symmetryσof a rooted tree, i.e., the order of the group of automorphisms on a particular labelling (of the vertices) oft.γ(t::RootedTree)ordensity(t): The densityγ(t)of a rooted tree, i.e., the product over all vertices oftof the order of the subtree rooted at that vertex.α(t::RootedTree): The number of monotonic labelings oftnot equivalent under the symmetry group.β(t::RootedTree): The total number of labelings oftnot 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) oft::RootedTreefor the Butcher coefficientsA, b, cof a Runge-Kutta method.derivative_weight(t, A, b, c): Compute the derivative weight (ΦᵢD)(t) oftfor the Butcher coefficientsA, b, cof a Runge-Kutta method.residual_order_condition(t, A, b, c): The residual of the order condition(Φ(t) - 1/γ(t)) / σ(t)with elementary weightΦ(t), densityγ(t), and symmetryσ(t)of the rooted treetfor the Runge-Kutta method with Butcher coefficientsA, b, c.
Brief Changelog
- v2.16: The LaTeX printing of rooted trees changed to allow representing colored rooted trees. Please update your LaTeX preamble as described in the docstring of
RootedTrees.latexify. - v2.0: Rooted trees are considered up to isomorphisms introduced by shifting each coefficient of their level sequence by the same number.
Referencing
If you use RootedTrees.jl for your research, please cite the paper
@article{ketcheson2023computing,
title={Computing with {B}-series},
author={Ketcheson, David I and Ranocha, Hendrik},
journal={ACM Transactions on Mathematical Software},
volume={49},
number={2},
year={2023},
month={06},
doi={10.1145/3573384},
eprint={2111.11680},
eprinttype={arXiv},
eprintclass={math.NA}
}In addition, you can also refer to RootedTrees.jl directly as
@misc{ranocha2019rootedtrees,
title={{RootedTrees.jl}: {A} collection of functionality around rooted trees
to generate order conditions for {R}unge-{K}utta methods in {J}ulia
for differential equations and scientific machine learning ({SciM}L)},
author={Ranocha, Hendrik and contributors},
year={2019},
month={05},
howpublished={\url{https://github.com/SciML/RootedTrees.jl}},
doi={10.5281/zenodo.5534590}
}RootedTrees.AdditiveRungeKuttaMethod — Type
AdditiveRungeKuttaMethod(rks)
AdditiveRungeKuttaMethod(As, bs, cs=map(A -> vec(sum(A, dims=2)), As))Represent an additive Runge-Kutta method with collections of Butcher coefficients As, bs, and cs. Alternatively, you can pass a collection of RungeKuttaMethods to the constructor. If the cs are not provided, the usual "row sum" requirement of consistency with autonomous problems is applied.
An additive Runge-Kutta method applied to the ODE problem
\[ u'(t) = \sum_\nu f^\nu(t, u(t))\]
has the form
\[\begin{aligned} y^i &= u^n + \Delta t \sum_\nu \sum_j a^\nu_{i,j} f^\nu(t^n + c_j \Delta t, y^j), \\ u^{n+1} &= u^n + \Delta t \sum_\nu \sum_i b^\nu_{i} f^\nu(t^n + c_i \Delta t, y^i). \end{aligned}\]
In particular, additive Runge-Kutta methods are a superset of partitioned RK methods, which are applied to partitioned problems of the form
\[ (u^1)'(t) = f^1(t, u^1, u^2), \quad (u^2)'(t) = f^2(t, u^1, u^2).\]
References
- A. L. Araujo, A. Murua, and J. M. Sanz-Serna. "Symplectic Methods Based on Decompositions". SIAM Journal on Numerical Analysis 34.5 (1997): 1926-1947. DOI: 10.1137/S0036142995292128
RootedTrees.BicoloredRootedTree — Type
BicoloredRootedTree{T<:Integer}Representation of bicolored rooted trees.
See also ColoredRootedTree, RootedTree, rootedtree.
RootedTrees.BicoloredRootedTreeIterator — Type
BicoloredRootedTreeIterator(order::Integer)Iterator over all bicolored 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.
RootedTrees.ColoredRootedTree — Type
ColoredRootedTree(level_sequence, color_sequence, is_canonical::Bool=false)Represents a colored rooted tree using its level sequence. The single-colored version is RootedTree.
See also BicoloredRootedTree, rootedtree.
This is a low-overhead and unsafe constructor. Please consider calling rootedtree instead.
References
- Terry Beyer and Sandra Mitchell Hedetniemi. "Constant time generation of rooted trees". SIAM Journal on Computing 9.4 (1980): 706-712. DOI: 10.1137/0209055
- A. L. Araujo, A. Murua, and J. M. Sanz-Serna. "Symplectic Methods Based on Decompositions". SIAM Journal on Numerical Analysis 34.5 (1997): 1926–1947. DOI: 10.1137/S0036142995292128
RootedTrees.PartitionForestIterator — Type
PartitionForestIterator(t::AbstractRootedTree, edge_set)Lazy iterator representation of the partition_forest of the rooted tree t. Similar to RootedTreeIterator, you should copy the iterates if you want to store or modify them during the iteration since they may be views to internal caches.
See also partition_forest, partition_skeleton, and PartitionIterator.
References
Section 2.3 of
- Philippe Chartier, Ernst Hairer, Gilles Vilmart (2010) Algebraic Structures of B-series. Foundations of Computational Mathematics DOI: 10.1007/s10208-010-9065-1
RootedTrees.PartitionIterator — Type
PartitionIterator(t::AbstractRootedTree)Iterator over all partition forests and skeletons of the rooted tree t. This is basically a pure iterator version of all_partitions. In particular, the partition forest may only be realized as an iterator. Similar to RootedTreeIterator, you should copy the iterates if you want to store or modify them during the iteration since they may be views to internal caches.
See also partition_forest, partition_skeleton, and PartitionForestIterator.
References
Section 2.3 of
- Philippe Chartier, Ernst Hairer, Gilles Vilmart (2010) Algebraic Structures of B-series. Foundations of Computational Mathematics DOI: 10.1007/s10208-010-9065-1
RootedTrees.RootedTree — Type
RootedTree(level_sequence, is_canonical::Bool=false)Represents a rooted tree using its level sequence.
This is a low-overhead and unsafe constructor. Please consider calling rootedtree instead.
References
- Terry Beyer and Sandra Mitchell Hedetniemi. "Constant time generation of rooted trees". SIAM Journal on Computing 9.4 (1980): 706-712. DOI: 10.1137/0209055
RootedTrees.RootedTreeIterator — Type
RootedTreeIterator(order::Integer)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.
RootedTrees.RosenbrockMethod — Type
RosenbrockMethod(γ, A, b, c=vec(sum(A, dims=2)))Represent a Rosenbrock (or Rosenbrock-Wanner, ROW) method with coefficients γ, A, b, and c. If c is not provided, the usual "row sum" requirement of consistency with autonomous problems is applied.
Reference
- Ernst Hairer, Gerhard Wanner. Solving ordinary differential equations II: Stiff and differential-algebraic problems. Springer, 2010. Section IV.7
RootedTrees.RungeKuttaMethod — Type
RungeKuttaMethod(A, b, c=vec(sum(A, dims=2)))Represent a Runge-Kutta method with Butcher coefficients A, b, and c. If c is not provided, the usual "row sum" requirement of consistency with autonomous problems is applied.
RootedTrees.SplittingIterator — Type
SplittingIterator(t::RootedTree)Iterator over all splitting forests and subtrees of the rooted tree t. This is basically an iterator version of all_splittings.
See also partition_forest and partition_skeleton.
References
Section 2.2 of
- Philippe Chartier, Ernst Hairer, Gilles Vilmart (2010) Algebraic Structures of B-series. Foundations of Computational Mathematics DOI: 10.1007/s10208-010-9065-1
RootedTrees.SubtreeIterator — Type
SubtreeIterator(t::AbstractRootedTree)Lazy iterator representation of the subtrees of the rooted tree t. Similar to RootedTreeIterator, you should copy the iterates if you want to store or modify them during the iteration since they may be views to internal caches.
Base.:== — Method
==(t1::RootedTree, t2::RootedTree)Compares two rooted trees based on their level sequences while considering equivalence classes given by different root indices.
Examples
julia> t1 = rootedtree([1, 2, 3]);
julia> t2 = rootedtree([2, 3, 4]);
julia> t3 = rootedtree([1, 2, 2]);
julia> t1 == t2
true
julia> t1 == t3
falseBase.:∘ — Method
t1 ∘ t2The non-associative Butcher product of rooted trees. It is formed by adding an edge from the root of t1 to the root of t2.
See also butcher_product!.
Reference: Section 301 of
- Butcher, John Charles. Numerical methods for ordinary differential equations. John Wiley & Sons, 2016.
Base.isless — Method
isless(t1::ColoredRootedTree, t2::ColoredRootedTree)Compares two colored rooted trees using a lexicographical comparison of their level (first) and color (second) sequences while considering equivalence classes given by different root indices.
Base.isless — Method
isless(t1::RootedTree, t2::RootedTree)Compares two rooted trees using a lexicographical comparison of their level sequences while considering equivalence classes given by different root indices.
RootedTrees.all_partitions — Method
all_partitions(t::RootedTree)Create all partition forests and skeletons of a rooted tree t. This returns vectors of the return values of partition_forest and partition_skeleton when looping over all possible edge sets.
See also PartitionIterator.
References
Section 2.3 of
- Philippe Chartier, Ernst Hairer, Gilles Vilmart (2010) Algebraic Structures of B-series. Foundations of Computational Mathematics DOI: 10.1007/s10208-010-9065-1
RootedTrees.all_splittings — Method
all_splittings(t::RootedTree)Create all splitting forests and subtrees associated to ordered subtrees of a rooted tree t.
See also SplittingIterator.
References
Section 2.2 of
- Philippe Chartier, Ernst Hairer, Gilles Vilmart (2010) Algebraic Structures of B-series. Foundations of Computational Mathematics DOI: 10.1007/s10208-010-9065-1
RootedTrees.butcher_product! — Method
butcher_product!(t, t1, t2)Compute the non-associative Butcher product t = t1 ∘ t2 of rooted trees in-place. It is formed by adding an edge from the root of t1 to the root of t2.
See also ∘ (available as \circ plus TAB).
Reference: Section 301 of
- Butcher, John Charles. Numerical methods for ordinary differential equations. John Wiley & Sons, 2016.
RootedTrees.butcher_representation — Function
butcher_representation(t::RootedTree)Returns the representation of t::RootedTree introduced by Butcher as a string. Thus, the rooted tree consisting whose only vertex is the root itself is represented as τ. The representation of other trees is defined recursively; if t₁, t₂, ... tₙ are the subtrees of the rooted tree t, it is represented as t = [t₁ t₂ ... tₙ]. If multiple subtrees are the same, their number of occurrences is written as a power.
Examples
julia> rootedtree([1, 2, 3, 2]) |> butcher_representation
"[[τ]τ]"
julia> rootedtree([1, 2, 3, 3, 2]) |> butcher_representation
"[[τ²]τ]"References
Section 300 of
- Butcher, John Charles. Numerical methods for ordinary differential equations. John Wiley & Sons, 2008.
RootedTrees.canonical_representation! — Function
canonical_representation!(t::AbstractRootedTree)Change the representation of the rooted tree t to the canonical one, i.e., the one with lexicographically biggest level sequence.
See also canonical_representation.
RootedTrees.canonical_representation — Method
canonical_representation(t::AbstractRootedTree)Returns a new tree using the canonical representation of the rooted tree t, i.e., the one with lexicographically biggest level sequence.
See also canonical_representation!.
RootedTrees.check_canonical — Method
check_canonical(t::AbstractRootedTree)Check whether t is in canonical representation.
RootedTrees.count_trees — Method
count_trees(order)Counts all rooted trees of order.
RootedTrees.density — Method
γ(t::AbstractRootedTree)
density(t::AbstractRootedTree)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
- Butcher, John Charles. Numerical methods for ordinary differential equations. John Wiley & Sons, 2008.
RootedTrees.derivative_weight — Method
derivative_weight(t::ColoredRootedTree, ark::AdditiveRungeKuttaMethod)Compute the derivative weight (ΦᵢD)(t) of the AdditiveRungeKuttaMethod ark for the colored rooted tree t.
References
- A. L. Araujo, A. Murua, and J. M. Sanz-Serna. "Symplectic Methods Based on Decompositions". SIAM Journal on Numerical Analysis 34.5 (1997): 1926–1947. DOI: 10.1137/S0036142995292128
- Butcher, John Charles. Numerical methods for ordinary differential equations. John Wiley & Sons, 2008. Section 312
RootedTrees.derivative_weight — Method
derivative_weight(t::RootedTree, ros::RosenbrockMethod)Compute the derivative weight (ΦᵢD)(t) of the RosenbrockMethod ros for the rooted tree t.
RootedTrees.derivative_weight — Method
derivative_weight(t::RootedTree, rk::RungeKuttaMethod)Compute the derivative weight (ΦᵢD)(t) of the RungeKuttaMethod rk with Butcher coefficients A, b, c for the rooted tree t.
Reference: Section 312 of
- Butcher, John Charles. Numerical methods for ordinary differential equations. John Wiley & Sons, 2008.
RootedTrees.elementary_differential_latexstring — Method
elementary_differential_latexstring(t::RootedTree)Returns the elementary differential as a LaTeXString from the package LaTeXStrings.jl.
RootedTrees.elementary_weight — Method
elementary_weight(t::ColoredRootedTree, ark::AdditiveRungeKuttaMethod)Compute the elementary weight Φ(t) of the AdditiveRungeKuttaMethod ark for a colored rooted tree t.
References
- A. L. Araujo, A. Murua, and J. M. Sanz-Serna. "Symplectic Methods Based on Decompositions". SIAM Journal on Numerical Analysis 34.5 (1997): 1926–1947. DOI: 10.1137/S0036142995292128
- Butcher, John Charles. Numerical methods for ordinary differential equations. John Wiley & Sons, 2008. Section 312
RootedTrees.elementary_weight — Method
elementary_weight(t::RootedTree, ros::RosenbrockMethod)Compute the elementary weight Φ(t) of the RosenbrockMethod ros for a rooted tree t.
RootedTrees.elementary_weight — Method
elementary_weight(t::RootedTree, rk::RungeKuttaMethod)
elementary_weight(t::RootedTree, A::AbstractMatrix, b::AbstractVector, c::AbstractVector)Compute the elementary weight Φ(t) of the RungeKuttaMethod rk with Butcher coefficients A, b, c for a rooted tree t.
Reference: Section 312 of
- Butcher, John Charles. Numerical methods for ordinary differential equations. John Wiley & Sons, 2008.
RootedTrees.elementary_weight_latexstring — Method
elementary_weight_latexstring(t::RootedTree)Returns the elementary_weight as a LaTeXString from the package LaTeXStrings.jl.
RootedTrees.latexify — Method
latexify(t::Union{RootedTree, BicoloredRootedTree})Return a LaTeX representation of the rooted tree t. This makes use of the LaTeX package forest and assumes that you use the following LaTeX code in the preamble.
% Classical and colored Butcher trees based on
% https://tex.stackexchange.com/a/673436
\usepackage{forest}
\forestset{
whitenode/.style={draw, circle, minimum size=0.5ex, inner sep=0pt},
blacknode/.style={draw, fill=black, circle, minimum size=0.5ex, inner sep=0pt},
colornode/.style={draw, fill=#1, circle, minimum size=0.5ex, inner sep=0pt},
colornode/.default={red}
}
\newcommand{\blankforrootedtree}{\rule{0pt}{0pt}}
\NewDocumentCommand\rootedtree{o}{\begin{forest}
for tree={grow'=90, thick, edge=thick, l sep=0.5ex, l=0pt, s sep=0.5ex},
delay={
where content={}{
for children={no edge, before drawing tree={for tree={y-=5pt}}}
}
{
where content={o}{content={\blankforrootedtree}, whitenode}{
where content={.}{content={\blankforrootedtree}, blacknode}{}
}
}
}
[#1]
\end{forest}}
To change the style of latexify to a human-readable Butcher-representation, you can use RootedTrees.set_latexify_style.
Examples
julia> rootedtree([1, 2, 2]) |> RootedTrees.latexify |> println
\rootedtree[.[.][.]]
julia> rootedtree([1, 2, 3, 3, 2]) |> RootedTrees.latexify |> println
\rootedtree[.[.[.][.]][.]]RootedTrees.normalize_root! — Function
normalize_root!(t::AbstractRootedTree, root=one(eltype(t.level_sequence)))Normalize the level sequence of the rooted tree t such that the root is set to root.
RootedTrees.order — Method
order(t::AbstractRootedTree)The order of a rooted tree t, i.e., the length of its level sequence.
RootedTrees.partition_forest — Method
partition_forest(t::RootedTree, edge_set)Form the partition forest of the rooted tree t where edges marked with false in the edge_set are removed. The ith value in the Boolean iterable edge_set corresponds to the edge connecting node i+1 in the level sequence to its parent.
See also partition_skeleton, PartitionIterator, and PartitionForestIterator.
References
Section 2.3 of
- Philippe Chartier, Ernst Hairer, Gilles Vilmart (2010) Algebraic Structures of B-series. Foundations of Computational Mathematics DOI: 10.1007/s10208-010-9065-1
RootedTrees.partition_skeleton — Method
partition_skeleton(t::AbstractRootedTree, edge_set)Form the partition skeleton of the rooted tree t, i.e., the rooted tree obtained by contracting each tree of the partition forest to a single vertex and re-establishing the edges removed to obtain the partition forest.
See also partition_forest and PartitionIterator.
References
Section 2.3 (and Section 6.1 for colored trees) of
- Philippe Chartier, Ernst Hairer, Gilles Vilmart (2010) Algebraic Structures of B-series. Foundations of Computational Mathematics DOI: 10.1007/s10208-010-9065-1
RootedTrees.residual_order_condition — Method
residual_order_condition(t::ColoredRootedTree, ark::AdditiveRungeKuttaMethod)The residual of the order condition (Φ(t) - 1/γ(t)) / σ(t) with elementary_weight Φ(t), density γ(t), and symmetry σ(t) of the AdditiveRungeKuttaMethod ark for the colored rooted tree t.
References
- A. L. Araujo, A. Murua, and J. M. Sanz-Serna. "Symplectic Methods Based on Decompositions". SIAM Journal on Numerical Analysis 34.5 (1997): 1926–1947. DOI: 10.1137/S0036142995292128
- Butcher, John Charles. Numerical methods for ordinary differential equations. John Wiley & Sons, 2008. Section 312
RootedTrees.residual_order_condition — Method
residual_order_condition(t::RootedTree, ros::RosenbrockMethod)The residual of the order condition (Φ(t) - 1/γ(t)) / σ(t) with elementary_weight Φ(t), density γ(t), and symmetry σ(t) of the RosenbrockMethod ros for the rooted tree t.
Reference
- Ernst Hairer, Gerhard Wanner. Solving ordinary differential equations II: Stiff and differential-algebraic problems. Springer, 2010. Section IV.7
RootedTrees.residual_order_condition — Method
residual_order_condition(t::RootedTree, rk::RungeKuttaMethod)The residual of the order condition (Φ(t) - 1/γ(t)) / σ(t) with elementary_weight Φ(t), density γ(t), and symmetry σ(t) of the RungeKuttaMethod rk with Butcher coefficients A, b, c for the rooted tree t.
Reference: Section 315 of
- Butcher, John Charles. Numerical methods for ordinary differential equations. John Wiley & Sons, 2008.
RootedTrees.root_color — Method
root_color(t::ColoredRootedTree)Return the color of the root of t.
RootedTrees.rootedtree! — Method
rootedtree!(level_sequence, color_sequence)Construct a canonical ColoredRootedTree object from a level_sequence and a color_sequence which may be modified in this process. See also rootedtree.
References
- Terry Beyer and Sandra Mitchell Hedetniemi. "Constant time generation of rooted trees". SIAM Journal on Computing 9.4 (1980): 706-712. DOI: 10.1137/0209055
RootedTrees.rootedtree! — Method
rootedtree!(level_sequence)Construct a canonical RootedTree object from a level_sequence which may be modified in this process. See also rootedtree.
This may modify the level_sequence and further modifications of the level_sequence may invalidate the rooted tree returned by this function. Please consider calling rootedtree instead.
References
- Terry Beyer and Sandra Mitchell Hedetniemi. "Constant time generation of rooted trees". SIAM Journal on Computing 9.4 (1980): 706-712. DOI: 10.1137/0209055
RootedTrees.rootedtree — Method
rootedtree(level_sequence, color_sequence)Construct a canonical ColoredRootedTree object from a level_sequence and a color_sequence, i.e., a vector of integers representing the levels of each node of the tree and a vector of associated colors (e.g., Bools or Integers).
References
- Terry Beyer and Sandra Mitchell Hedetniemi. "Constant time generation of rooted trees". SIAM Journal on Computing 9.4 (1980): 706-712. DOI: 10.1137/0209055
RootedTrees.rootedtree — Method
rootedtree(level_sequence)Construct a canonical RootedTree object from a level_sequence, i.e., a vector of integers representing the levels of each node of the tree.
References
- Terry Beyer and Sandra Mitchell Hedetniemi. "Constant time generation of rooted trees". SIAM Journal on Computing 9.4 (1980): 706-712. DOI: 10.1137/0209055
RootedTrees.set_latexify_style — Method
RootedTrees.set_latexify_style(style::String)Set the style of rooted trees when using latexify. Possible options are
- "butcher": print the
butcher_representationof rooted trees - "forest": use the LaTeX macro
\rootedtreedescribed in the docstring oflatexify
This system is based on Preferences.jl.
RootedTrees.set_printing_style — Method
RootedTrees.set_printing_style(style::String)Set the printing style of rooted trees. Possible options are
- "butcher": print the
butcher_representationof rooted trees - "sequence": print the level sequence representation
This system is based on Preferences.jl.
RootedTrees.subtrees — Method
subtrees(t::ColoredRootedTree)Returns a vector of all subtrees of t.
RootedTrees.subtrees — Method
RootedTrees.symmetry — Method
σ(t::AbstractRootedTree)
symmetry(t::AbstractRootedTree)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
- Butcher, John Charles. Numerical methods for ordinary differential equations. John Wiley & Sons, 2008.
RootedTrees.unsafe_copyto! — Method
unsafe_copyto!(t_dst::AbstractRootedTree, dst_offset,
t_src::AbstractRootedTree, src_offset, N)Copy N nodes from t_src starting at offset src_offset to t_dst starting at offset dst_offset. The types of the rooted trees must match. For example, you cannot copy a ColoredRootedTree to a RootedTree.
This is an unsafe operation since the rooted tree t_dst will not necessarily be in canonical representation afterwards, even if the corresponding flag of t_dst is set. Use with caution!
RootedTrees.unsafe_deleteat! — Method
unsafe_deleteat!(t::AbstractRootedTree, i)Delete the node i from the rooted tree t. This is an unsafe operation since the rooted tree will not necessarily be in canonical representation afterwards, even if the corresponding flag of t is set. Use with caution!
RootedTrees.unsafe_resize! — Method
unsafe_resize!(t::AbstractRootedTree, n::Integer)Resize the rooted tree t to n nodes. This is an unsafe operation since the rooted tree will not necessarily be in canonical representation afterwards, even if the corresponding flag of t is set. Use with caution!
RootedTrees.α — Method
α(t::AbstractRootedTree)The number of monotonic labelings of t not equivalent under the symmetry group.
Reference: Section 302 of
- Butcher, John Charles. Numerical methods for ordinary differential equations. John Wiley & Sons, 2008.
RootedTrees.β — Method
β(t::AbstractRootedTree)The total number of labelings of t not equivalent under the symmetry group.
Reference: Section 302 of
- Butcher, John Charles. Numerical methods for ordinary differential equations. John Wiley & Sons, 2008.