Q22Comprehension5 Marks24 Dec 2023
Passage
Based on the above data, answer the given subquestions.
Let M be an adjacency matrix of a graph G given below.
```
Procedure updateMatrix(AM)
tempMat = AM
foreach i in rows(AM){
foreach j in columns(AM){
foreach k in columns(AM){
if(AM[i][k] == 1 and AM[k][j] == 1){
tempMat[i][j] = 1
}
}
}
}
return(tempMat)
End updateMatrix
```

What will the values of p and q be at the end of execution of the pseudocode given below?
newMatrix1 = updateMatrix(M)
p = newMatrix1[1][2]
q = newMatrix1[2][5]