Retrieving functional pathways of biomolecules from single-particle snapshots