handled graph comparison when graphs are large