  We characterize the extremal trees that maximize the number of almost-perfect
matchings, which are matchings covering all but one or two vertices, and those
that maximize the number of strong almost-perfect matchings, which are
matchings missing only one or two leaves. We also determine the trees that
minimize the number of maximal matchings. We apply these results to extremal
problems on the weighted Hosoya index for several choices of
vertex-degree-based weight function.

Combinatorics