Greetings,
I am working on HW3 and noticed that the algorithm for BCNF decomposition has the following line:"''If there are BCNF violations, let one be X→Y .''" '''Depending on which dependency we pick out of our set of dependencies the decomposition will be different'''. Since in our code we are using a Set<FunctionalDependency> to store our functional dependencies, we randomly pick one and have different decomposition on different runs; all of them in BCNF.For example, for the sample input you posted in the homework two answers are possible depending on which FD is picked to run the decomposition algorithm: 2,3 1,4 1,3,5 or 1,3 2,3 1,2,5 1,4
If what we did is not correct, how are we supposed to pick the FD that violates BCNF in order to always get the same output as you?
Thank you,
I would avoid randomness unless there is a strong case for using it. Just use the order that you are storing the FDs determine the order that you are considering them.
Best,
Chris