The following pseudocode is executed using the "Scores" table. At the end of the execution, matrix represents the adjacency matrix of the graph generated from the "Scores" table. If matrixMa[i][j] == 1, then:
```
D = {}
while(Table 1 has more rows){
Read the first row X in Table 1
D[X.SeqNo] = {"P": X.Physics, "C": X.Chemistry, "M": X.Mathematics}
Move X to Table 2
}
matrixPh = getAdjMatrix(D, "P")
matrixCh = getAdjMatrix(D, "C")
matrixMa = getAdjMatrix(D, "M")
Procedure getAdjMatrix(D, Subject)
n = length(keys(D))
matrix = createMatrix(n, n)
foreach i in rows(matrix){
foreach j in columns(matrix){
if(i != j){
diff = D[i][Subject] - D[j][Subject]
if(20 <= diff and diff <= 30){
matrix[i][j] = 1
}
}
}
}
return(matrix)
} end getAdjMatrix
```
―――――――――――――――――――――――――――――――――――――――――――――――――――――――