From the question, it is not clear what are the arrays B and C mean.
these are the edges of the graphs
from B to C;
So does it mean B[i] is a prerequisite of C[i] ?
B[i] is a prerequisite of C[i]