Im trying to implement topological sorting for my Bayesian network by following the pseudo code in https://en.wikipedia.org/wiki/Topological_sorting
When running my code