Natural selection of paths in networks