Quantifying source and sink habitats and pathways in spatially structured populations: A generalized modelling approach