  We present an algorithm which takes as input a finite set $X$ of
automorphisms of a simplicial tree, and outputs a generating set $X'$ of
$\langle X \rangle$ such that either $\langle X \rangle$ is purely hyperbolic
and $X'$ is a free basis of $\langle X \rangle$, or $X'$ contains a non-trivial
elliptic element. As a special case, the algorithm decides whether a finitely
generated group acting on a locally finite tree is discrete and free. This
algorithm, which is based on Nielsen's reduction method, works by repeatedly
applying Nielsen transformations to $X$ to minimise the generators of $X'$ with
respect to a given pre-well-ordering. We use this algorithm to solve the
constructive membership problem for finitely generated purely hyperbolic
automorphism groups of trees. We provide a Magma implementation of these
algorithms, and report its performance.
