  This article presents a method for finding the critical probability $p_c$ for
the Bernoulli bond percolation on graphs with the so-called tree-like
structure. Such a graph can be decomposed into a tree of pieces, each of which
has finitely many isomorphism classes. This class of graphs includes the Cayley
graphs of amalgamated products, HNN extensions or general groups acting on
trees. It also includes all transitive graphs with more than one end. The idea
of the method is to find a multi-type Galton--Watson branching process (with a
parameter $p$) which has finite expected population size if and only if the
expected percolation cluster size is finite. This provides sufficient
information about $p_c$. In particular, if the pairwise intersections of pieces
are finite, then $p_c$ is the smallest positive $p$ such that $\operatorname
{det}(M-1)=0$, where $M$ is the first-moment matrix of the branching process.
If the pieces of the tree-like structure are finite, then $p_c$ is an algebraic
number and we give an algorithm computing $p_c$ as a root of some algebraic
function. We show that any Cayley graph of a virtually free group (i.e., a
group acting on a tree with finite vertex stabilizers) with respect to any
finite generating set has a tree-like structure with finite pieces. In
particular, we show how to compute $p_c$ for the Cayley graph of a free group
with respect to any finite generating set.
