The collapse of a dam in northeast Nigeria caused heavy flooding in the city of Maiduguri that killed at least 30 people and forced 400,000 people to leave their homes.