Calculating the forcing number of graphs