added examples
[ker1415-1.git] / pl-files / hittingSetTree.pl
1 :- [diagnosis].
2
3 isHittingSetTree(Tree) :-
4 isHittingSetTree2(Tree, []). %function to add variable for uniqueness checking
5
6 isHittingSetTree2(leaf, _). %when end of branch has been reached
7 isHittingSetTree2(node([], []), _). %when a node turns empty
8 isHittingSetTree2(node([X|Xs], [Y|Ys]), Z) :-
9 not(member(X,Z)), %check if label has already been used up in the tree
10 append(Z, [X], Appended), %append label to list of checked labels
11 isHittingSetTree2(Y, Appended), %go into depth
12 isHittingSetTree2(node(Xs, Ys), Z). %go into width
13