Stability analysis of generalized epidemic models over directed networks