Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
pp:l11 [2020/05/12 15:59] pdmatei |
pp:l11 [2020/05/19 14:42] (current) pdmatei |
||
---|---|---|---|
Line 40: | Line 40: | ||
10. Write a predicate ''subset'' where ''subset(C,V)'' generates all subsets of ''V''. Hint: build the recursion scheme after **each** element in V. | 10. Write a predicate ''subset'' where ''subset(C,V)'' generates all subsets of ''V''. Hint: build the recursion scheme after **each** element in V. | ||
- | 11. **What is the difference between ''?- length(K), subset(C,V).'' and ''?- ksubset(C,K,V).''?** where ''K'' is an instantiated variable (with a value less or equal to the size of ''V''). Write your answer down. | + | 11. **What is the difference between ''?- length(C,K), subset(C,V).'' and ''?- ksubset(C,K,V).''?** where ''K'' is an instantiated variable (with a value less or equal to the size of ''V''). Write your answer down. |
12. Implement ''kvertexcover/3'' where ''kvertexcover(C,K,G)'' generates all ''K''-coverings in ''G''. ''G=[V,E]'' where ''V'' is a set of nodes and ''E'' is a set of undirected edges. Hint: use negation to express a //universal// constraint. | 12. Implement ''kvertexcover/3'' where ''kvertexcover(C,K,G)'' generates all ''K''-coverings in ''G''. ''G=[V,E]'' where ''V'' is a set of nodes and ''E'' is a set of undirected edges. Hint: use negation to express a //universal// constraint. | ||
Line 48: | Line 48: | ||
14. Implement ''connected/4'', where ''connected(X,Y,P,G)'' generates all paths ''P'' between nodes ''X'' and ''Y'' in graph ''G''. | 14. Implement ''connected/4'', where ''connected(X,Y,P,G)'' generates all paths ''P'' between nodes ''X'' and ''Y'' in graph ''G''. | ||
- | 14. Implement ''ham/2'' where ''ham(P,G)'' generates all **hamiltonian paths** in G. | + | 15. Implement ''ham/2'' where ''ham(P,G)'' generates all **hamiltonian paths** in G. |