A sink in a directed graph is a vertex i such that there is an edge from every vertex $j \neq i$ to $i$ and there is no edge from $i$ to any other vertex. A directed graph $G$ with $n$ vertices is represented by its adjacency matrix $A$, where $A[i] [j] = 1$ if there is an edge directed from vertex $i$ to $j$ and $0$ otherwise. The following algorithm determines whether there is a sink in the graph $G$.
i = 0;
do {
j = i + 1;
while ((j < n) && E1) j++;
if (j < n) E2;
} while (j < n);
flag = 1;
for (j = 0; j < n; j++)
if ((j! = i) && E3) flag = 0;
if (flag) printf("Sink exists") ;
else printf ("Sink does not exist");
Choose the correct expression for $E_3$
- $(A[i][j] \ \&\& \ !A[j][i])$
- $(!A[i][j] \ \&\& \ A[j][i])$
- $(!A[i][j] \ \left | \right | A[j][i])$
- $(A[i][j] \ \left | \right | \ !A[j][i])$