The total graph and regular graph of a commutative ring