For the intended application, it does not matter. What is important is that
g2 are isomorphic if and only if
CanonicalGraph[g1] === CanonicalGraph[g2].
There are many different ways to define (and compute) a canonical form with this property. All of them are complicated. For example, the Bliss library (which you can access in Mathematica through IGraph/M) provides multiple such forms.