Forgot to add that function collation "and"'s two binary vectors. For example 1 0 0 and 1 0 1 in collation returns 1 0 0. But how already said, the algorithm itself should work fine because with small graphs I don't have problems