Claim — The graph G′ has at least as many triangles as G, and has strictly more if G has any fatal vertices.
Proof. Obviously any triangle in G persists in G′. Moreover, suppose v is a fatal vertex of G. Then the neighbors of G will form a clique in G′ which was not there already, so there are more triangles. □
Thus we only need to consider graphs G with no fatal vertices. Looking at the connected components, the only possibilities are cliques (including single vertices), cycles, and paths. So in what follows we restrict our attention to graphs G only consisting of such components.
Remark (Warning). Beware: assuming G is connected loses generality. For example, it could be that G=G1⊔G2, where G1′≅G2 and G2′≅G1.
First, note that the following are stable under the operation:
* an isolated vertex,
* a cycle of odd length, or
* a clique with at least three vertices.
In particular, G≅G′′ holds for such graphs.
On the other hand, cycles of even length or paths of nonzero length will break into more connected components. For this reason, a graph G with any of these components will not satisfy G≅G′′ because G′ will have strictly more connected components than G, and G′′ will have at least as many as G′.
Therefore G≅G′′ if and only if G is a disjoint union of the three types of connected components named earlier. Since G≅G′ holds for such graphs as well, the problem statement follows right away.