Utilities

BranchingProcesses.reduce_treeFunction
reduce_tree(tree::BranchingProcessSolution)

Reduce BranchingProcessSolution tree to an ordinary time series by combining the values of all particles alive at each time point. The timespan of the resulting time series is from the initial time of the root to the latest final time of any of the leaves of the input tree; the time points are spaced by dt (default: 0.01). The function transform (default: identity) is applied to the values of each particle before combining them. The function reduction (either "sum" (default) or "prod") is used to combine the (transformed) values of all particles alive at each time point.

Note that if the resulting time series has different time points than the original trajectories in the input tree, the interpolating function of the solver used to sample the original trajectories is used to compute the reduced time series. Any keyword arguments kwargs... (for instance idxs=[1,3,5] to summarize only a subset variables) are passed to the interpolating function.

BranchingProcesses.node_generationsFunction
node_generations(root::BranchingProcessNode)

Compute the generation (distance from root) for all nodes in the tree. Returns a dictionary mapping each node to its generation, where the root has generation 0, its direct children have generation 1, etc.