
Drawing the diagrams: Functional dependency diagrams are a useful diagrammatic way of showing functional dependencies. They are especially helpful in deducing the closure of an attribute set or of a set of functional dependencies. These diagrams are not used by Silberschatz, Korth, and Sudarshan. They can be found in Date's book, but he does not give a formal definition of the rules for drawing these diagrams. The following are some guidelines for drawing functional dependency diagrams.
Example: Given the set of functional dependencies
The FD diagram for this set of FDs would be:
Coloring Algorithm: An algorithm for using a FD diagram to compute the closure of an attribute set is as follows:
When finished, the closure of the attribute set is colored. For
example, applying this procedure to the attribute set
with the
above functional dependency set,
and
are colored, then the
first round colors
and
via
. Then since both
and
are
colored, the box containing them is colored. Then
is colored
via either
or
, and
is colored via
. At this point
everything is colored, showing that
is the whole schema and
hence
is a candidate key.