Ideal based trace graph of matrices