Q29Comprehension2 Marks3 Sep 2023
Passage
Consider a graph generated from the "Words" table that is represented by a matrix . Each node in the graph corresponds to a word from the table. SeqNo is used to label the nodes in the graph. Study the given pseudocode and answer the subquestions.
```
A = {}
while(Table 1 has more rows){
Read the first row X in Table 1
A[X.SeqNo] = [X.LetterCount, X.PartOfSpeech]
Move X to Table 2
}
n = length(keys(A))
M = createMatrix(n, n)
foreach i in keys(A){
foreach j in keys(A){
if(last(A[i]) != last(A[j]) and isCompatible(A[i], A[j])){
M[i][j] = 1
}
}
}
Procedure isCompatible(P, Q)
if(first(P) - first(Q) == -1){
return(True)
}
else{
return(False)
}
End isCompatible
```
Every pair of nodes with the same part of speech is connected by an edge.