Topological Sort - Build a Matrix With Conditions
In the following topological sort code snippet, which line is most likely causing incorrect position assignments due to improper in-degree updates?
1: for each node u in graph:
2: if inDegree[u] == 0:
3: queue.push(u)
4: while queue not empty:
5: node = queue.pop()
6: pos[node] = currentPosition++
7: for each neighbor v of node:
8: inDegree[v] -= 1
9: if inDegree[v] == 0:
10: queue.push(v)
