Computing the fundamental group of a higher-rank graph