# Checking Multiple Equal Graphs

first post on this amazing community, always been a lurker, so I'm sry if my formatting sucks. I'm having a really hard time trying to solve this problem:

Given m graphs each composed of the same n vertexes, find all the pairs of equal graphs(not isomorphic).

OBLIGATION: it is possible to elaborate an algorith that does better than checking every pair of graphs.

This algorithm has to be written in C, so it must be pretty "raw". My initial idea is to create an array of Graps and for each graph I store an array containing the Degrees of my vertex, if two graphs have different degree's array then I reject the pair of graph. This method kinda creams off some of the pair but for the worst case it's bad, because if I have m/m equal graphs I'll have to check every pair anyways.

I have no clue on how to solve this problem, any suggestion is highly appreciated.

• Hint: If you sort a list of numbers, what do you notice about the positions of equal numbers? – j_random_hacker May 21 '18 at 16:07
• Mhh they are in consecutive positions? – Bjerg466 May 21 '18 at 16:14
• What if in my list I have all equal numbers? Shouldn't i check every pair of numbers? – Bjerg466 May 21 '18 at 19:32