  The chemical evolution of galaxies that undergo an episode of massive and
rapid accretion of metal-poor gas is investigated with models using both
simplified and detailed nucleosynthesis recipes. The rapid decrease of the
oxygen abundance during infall is followed by a slower evolution which leads
back to the closed-box relation, thus forming a loop in the N/O-O/H diagram.
For large excursions from the closed-box relation, the mass of the infalling
material needs to be substantially larger than the gas remaining in the galaxy,
and the accretion rate should be larger than the star formation rate. We apply
this concept to the encounter of high velocity clouds with galaxies of various
masses, finding that the observed properties of these clouds are indeed able to
cause substantial effects not only in low mass galaxies, but also in the
partial volumes in large massive galaxies that would be affected by the
collision. Numerical models with detailed nucleosynthesis prescriptions are
constructed. We assume star formation timescales and scaled yields that depend
on the galactic mass, and which are adjusted to reproduce the average relations
of gas fraction, oxygen abundance, and effective oxygen yield observed in
irregular and spiral galaxies. The resulting excursions in the N/O-O/H diagram
due to a single accretion event involving a high velocity cloud are found to be
appreciable, which could thus provide a contribution to the large scatter in
the N/O ratio found among irregular galaxies. Nonetheless, the N/O-O/H diagram
remains an important indicator for stellar nucleosynthesis.
