, , , ; , (, , NP -). , , , , .
. (, ) , O (V lg V + E lg E ) , :
If |G1| != |G2|, the graphs are non-equal. Abort.
i = 0
For each vertex V in G1:
G1_M[Label(V)] = V
G1_I[V] = i
i = i + 1
For each vertex V in G1:
G1_E[V] = sort(map(λDestination -> G1_I[Destination]) Edges[V])
For each vertex V in G2:
If G1_M[Label(V)] does not exist, the graphs are non-equal. Abort.
G2_corresp[V] = G1_M[Label(V)]
G2_I[V] = G1_I[G2_corresp[V]]
For each vertex V in G2:
G1_E[V] = sort(map(λDestination -> G2_I[Destination]) Edges[V])
Compare G1_E[G2_corresp[V]] and G2_E[V]. If non-equal, the graphs are non-equal. Abort.
If we get here, the graphs are equal.