  Motivated by applications in network epidemiology, we consider the problem of
determining whether it is possible to delete at most $k$ edges from a given
input graph (of small treewidth) so that the resulting graph avoids a set
$\mathcal{F}$ of forbidden subgraphs; of particular interest is the problem of
determining whether it is possible to delete at most $k$ edges so that the
resulting graph has no connected component of more than $h$ vertices, as this
bounds the worst-case size of an epidemic. While even this special case of the
problem is NP-complete in general (even when $h=3$), we provide evidence that
many of the real-world networks of interest are likely to have small treewidth,
and we describe an algorithm which solves the general problem in time
\genruntime ~on an input graph having $n$ vertices and whose treewidth is
bounded by a fixed constant $w$, if each of the subgraphs we wish to avoid has
at most $r$ vertices. For the special case in which we wish only to ensure that
no component has more than $h$ vertices, we improve on this to give an
algorithm running in time $O((wh)^{2w}n)$, which we have implemented and tested
on real datasets based on cattle movements.
