add graph check for matrix_add