API reference
RandomTree.AbstractSimulator
— Type.Simulator on random/fixed trees
RandomTree.AbstractTree
— Type.Type of all trees represented by DFS degree sequences
RandomTree.BinaryTree
— Type.A conditional Galton-Watson tree with 2 Bernoulli(1/2)
offspring distrbiution.
RandomTree.BinaryTree
— Method.BinaryTree(size::Int)
Construct a BinaryTree
of size size
.
RandomTree.CayleyTree
— Type.A conditional Galton-Watson tree with Poission(1) offspring distrbiution.
RandomTree.CayleyTree
— Method.CayleyTree(size::Int)
Construct a CayleyTree
of size size
.
RandomTree.CondGWTree
— Type.Type of conditional Galton-Watson trees represented by DFS degree sequences
RandomTree.DFSWalker
— Type.A DFSWalker
does DFS walk on a tree to compute some property of the tree. It should implement at least one of the two functions.
visitfirst(walker::AbstractTreeWalker, degree_sequence, node_index, parent_index)
visitsecond(walker::AbstractTreeWalker, degree_sequence, node_index, parent_index)
The first is called when the DFS walk first enters a node. The second is call when the walk finally leaves the node.
RandomTree.DepthWalker
— Type.A walker computes the depths of all nodes in a tree.
RandomTree.FiniteTree
— Type.Type of fintie trees represented by DFS degree sequences
RandomTree.FirstOnlyDFSWalker
— Type.A DFS walker that only needed to be called when the walk enters a node.
RandomTree.FixedDirectedGraph
— Type.Representing a fixed directed graph with directed edges stored in an array
RandomTree.FixedGraph
— Type.Representing a fixed graph with edges stored in an array
RandomTree.FixedTreeGraph
— Type.Representing a fixed tree with directed edges stored in an array
RandomTree.FixedTreeGraph
— Method.FixedTreeGraph(size::Int, edges::Array{Tuple{Int, Int}})
Construct a FixedTreeGraph
with edges edges
of size size
.
RandomTree.FixedTreeGraph
— Method.FixedTreeGraph(size::Int)
Construct a FixedTreeGraph
with no edges of size
.
RandomTree.FullDAryTree
— Type.A fixed full-d-ary tree, i.e., in a tree each node has either d or 0 children and each level is full.
RandomTree.FullDAryTree
— Method.FullDAryTree(height::Int, d::Int)
Construct a FullDAryTree
of height height
and maximum degree d
.
RandomTree.GeneralCondGWTree
— Type.A conditional Galton-Watson tree.
RandomTree.GeneralCondGWTree
— Method.GeneralCondGWTree(size::Int, maxdegree::Int, dist::DiscreteUnivariateDistribution)
Construct a GeneralCondGWTree
of size size
, maximum degree maxdegree
, and offspring distribution dist
.
RandomTree.GeneralCondGWTree
— Method.GeneralCondGWTree(size::Int, maxdegree::Int, dist::DiscreteUnivariateDistribution)
Construct a GeneralCondGWTree
of size size
and offspring distribution dist
.
RandomTree.GraphWalker
— Type.A walker that converts a tree represented in DFS degree sequence to a FixedTreeGraph
.
RandomTree.HeightSimulator
— Type.Simulation of height of trees.
RandomTree.KcutSimulator
— Type.Simulation of the k-cut number of trees.
RandomTree.KcutWalker
— Type.A walker computes the (random) k-cut number of a tree.
RandomTree.KcutWalker
— Method.KcutWalker(k::Integer)
Construct a KcutWalker
to compute the k
-cut number of a tree.
RandomTree.LeafSimulator
— Type.Simulation of the number of leafs.
RandomTree.RandomRecursiveTree
— Type.A random recursive tree.
RandomTree.RandomRecursiveTree
— Method.RandomRecursiveTree(size::Int)
Construct a RandomRecursiveTree
of size size
.
RandomTree.SubtreeSizeWalker
— Type.A walker computes the size of all subtrees of a tree.
RandomTree.TotalPathSimulator
— Type.Simulation of the total path length of trees.
Base.size
— Method.size(t::FiniteTree)
Return the size of the tree t
Base.size
— Method.size(graph::FixedGraph)
Return the size of the graph graph
RandomTree.CatalanTree
— Method.CatalanTree(size::Int)
Construct a GeneralCondGWTree
with Geometric(1/2)
offspring distribution of size size
.
RandomTree.DAryTree
— Method.DAryTree(size::Int, d::Int)
Construct a GeneralCondGWTree
with Binomial(d, 1/d)
offspring distribution of size size
.
RandomTree.LogProductSimulator
— Method.LogProductSimulator(tree)
Construct a SubtreeSizeSimulator
that simulate the sum of log(subtree size) of trees.
RandomTree.LogProductSimulator
— Method.LogProductSimulator(tree, power)
Construct a SubtreeSizeSimulator
that simulate the sum of log(subtree size)^power
of trees.
RandomTree.MotzkinTree
— Method.MotzkinTree(size::Int)
Construct a GeneralCondGWTree
with DiscreteUniform(0, 2)
offspring distribution of size size
.
RandomTree.SizePowerSimulator
— Method.SizePowerSimulator(tree)
Construct a SubtreeSizeSimulator
that simulate the sum of sqrt(subtree size) of trees.
RandomTree.SizePowerSimulator
— Method.SizePowerSimulator(tree, power)
Construct a SubtreeSizeSimulator
that simulate the sum of (subtree size)^power
of trees.
RandomTree.addedge!
— Method.addedge!(tree::FixedGraph, from, to)
Add an edge (from, to)
in tree
.
RandomTree.degrees
— Function.degrees(tree)
Return an iterator that traverses the degree sequence of tree
in DFS order.
RandomTree.drawtree
— Function.Draw a grpahic representaion of a tree using graphivz and its Python Interface
RandomTree.drawtree
— Function.drawtree(tree_digraph::FixedGraph, show_label=false)
Draw a graphic representation of tree_digraph
RandomTree.drawtree
— Function.drawtree(tree::FiniteTree, show_label=false)
Draw a graphic representation of the random/fixed tree tree
.
RandomTree.drawtree
— Function.drawtree(deg_seq::Vector{Int}, show_label=false)
Draw a graphic representation of tree with DFS degree sequence deg_seq
RandomTree.edges
— Method.Return the array of edges of the graph
RandomTree.main
— Method.Entry point of command line script
RandomTree.maxdegree
— Method.maxdegree(t::FiniteTree)
Return the maximum degree of the tree t
RandomTree.name
— Method.name(t::FiniteTree)
Return the name of the tree t
RandomTree.nodes
— Method.Return the nodes of the graph as an iterator
RandomTree.positions
— Method.positions(tree::FixedTreeGraph)::Array{Int, 2}
First sort the edges in the tree and then return an array containing the position and length of the segment in the edge array corresponding to each node.
RandomTree.print_simulation
— Method.print_simulation(sim::AbstractSimulator, nsample)
Print nsample
samples in simulation sim
.
RandomTree.result
— Method.result(walker::AbstractTreeWalker)
Return of the result of the walk on the tree.
RandomTree.simulation
— Method.simulation(sim::AbstractSimulator, nsample)
Return nsample
samples in simulation sim
.
RandomTree.simulation
— Method.simulation(sim::SubtreeSizeSimulator)
Return one sample in simulation sim
.
RandomTree.sortedge!
— Method.sortedge!(tree::FixedTreeGraph)
Sort the edges in tree
according to starting nodes.
RandomTree.treegraph
— Function.treegraph(tree)::FixedTreeGraph
Either convert a fixed tree
to a FixedTreeGraph
, or generate a random FixedTreeGraph
according to tree
.
RandomTree.walk
— Method.walk(tree::FiniteTree, walker::DFSWalker)
Make walker
do a DFS walk on tree
.
RandomTree.FiniteFixedTree
— Type.Type of fintie fixed trees represented by DFS degree sequences
RandomTree.FiniteRandomTree
— Type.Type of fintie random trees represented by DFS degree sequences
RandomTree.SubtreeSizeSimulator
— Type.Simulation of the additive function in the form of sum of func(subtree size) applied to random trees.
RandomTree.TreeSpec
— Type.The specification of a tree.
RandomTree.TreeSpec
— Method.TreeSpec(size::Int, name::String)
Construct a TreeSpec
of size size
and name name
.
RandomTree.parse_commandline
— Method.Parse command line arguments
RandomTree.visitfirst
— Method.visitfirst(walker::AbstractTreeWalker, degree_sequence, node_index, parent_index)
The function is called when the walker
first enters a node.
RandomTree.visitsecond
— Method.visitsecond(walker::AbstractTreeWalker, degree_sequence, node_index, parent_index)
The function is called when the walker
finally leaves a node.