GATE / CS ARCHIVE

GATE CSE 2022 / QUESTION 37

GATE CSE 2022 Q37

Discrete Mathematics · Graph Theory · Full GATE CSE 2022 paper

GATE 2022, Q37 2 marks · MCQ
Report issue

Graph Theory

Question 37, GATE 2022: For a simple undirected unweighted graph on at least three vertices with adjacency matrix A, the triangle count is the trace of which matrix? A A³; B A³/2; C A³/3; D A³/6.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

The ith diagonal entry of A³ counts length-three closed walks starting at vertex i. In a simple undirected graph each such walk traverses a triangle. Each triangle contributes three starting vertices and two directions, hence six walks. Therefore the number of triangles is trace(A³)/6, D.

A length-three closed walk i→j→k→i cannot repeat an adjacent vertex because there are no loops, so i,j,k are distinct. Every triangle is counted starting at i,j,k and in each of two orientations: 3×2=6. Dividing by 3 alone would still count both orientations.

Original paper, page 24 · Answer key