The classification of the annihilating-ideal graph of a commutative ring