updated comparematrices so that it creates a graph