|
|
|
Most NP-complete problems look like they can be solved "easily", but looks here is very deceptive
Here is a list of NP-complete problems: click here
Assume that R = (A1, A2,..., An) SuperKeys := {}; for every possible subset X &sube {A1, A2,..., An} do { if ( X+ == R ) SuperKeys := SuperKeys ∪ X; } Remove all non-minimal sets from SuperKeys to find all keys |
Example: The subsets of R = (A1, A2, A3) are:
1. () - empty set 2. (A1) 3. (A2) 4. (A3) 5. (A1, A2) 6. (A1, A3) 7. (A2, A3) 8. (A1, A2, A3) |
Find all keys in the following relations:
R(A, B, C, D, E, F) ℉ = { A → BC BD → EF F → A } |
The subsets of R(A, B, C, D, E) are:
() (A) (A,B) (A,B,C) (A,B,C,D) (A,B,C,D,E) (A,B,C,D,E,F) (B) (A,C) (A,B,D) (A,B,C,E) (A,B,C,D,F) (C) (A,D) (A,B,E) (A,B,C,F) (A,B,C,E,F) (D) (A,E) (A,B,F) (A,B,D,E) (A,B,D,E,F) (E) (A,F) (A,C,D) (A,B,D,F) (A,C,D,E,F) (F) (B,C) (A,C,E) (A,C,D,E) (B,C,D,E,F) (B,D) (A,C,F) (A,C,D,F) (B,E) (A,D,E) (A,C,E,F) (B,F) (A,D,F) (A,D,E,F) (C,D) (A,E,F) (B,C,D,E) (C,E) (B,C,D) (B,C,D,F) (C,F) (B,C,E) (B,C,E,F) (D,E) (B,C,F) (C,D,E,F) (D,F) (B,D,E) (C,B,D,E) (E,F) (B,D,F) (C,B,D,E) (B,E,F) (C,D,E) (C,D,F) (C,E,F) (D,E,F) |
Compute the closure set for every subset
|