The goal of this function is to restrict the call of a function link(i, j) which is a nondeterministic operation that adds the arc i → j, the arc j → i, or does nothing at all.
the smaller the value of d is the fewer links can be drawn.