

explain_circuit(Num) :-
                length(VS, Num),
                circuit(VS),
                label(VS),
                write(VS),
                nl,
                explain_it(VS, VS),
                fail.

explain_it([]).
explain_it([H|T],VS) :- element(Index, VS, H),
                     write("Knoten "),
                     write(H),
                     write(" ist der Vorgaenger von Knoten "),
                     write(Index),
                     nl,
                     explain_it(T, VS).


circle(N,C):-
     length(C,N),
     circuit(C),
     label(C).

% http://www.swi-prolog.org/pldoc/doc_for?object=clpfd%3Acircuit/1
% https://de.wikipedia.org/wiki/Hamiltonkreisproblem

medallien_sort([ [8, 5, 7], [5, 3, 2],[8, 7, 4],[10, 5, 7], [5, 3, 7]],L).

medaillen_sort(Laender,Ergebnis) :-
    permutation(Laender,Laender2),
    lex_chain(Laender2),
    reverse(Ergebnis,Laender2).