test whether an undirected graph g is a tree (connected, acyclic) or
a forest (disjoing union of trees). The flag strict enforces the
strict rule that a forest must contain more than a single tree. The default
is to allow for single-tree forests, which is the convention.