Code:
knoten(a).
knoten(b).
knoten(c).
knoten(d).
knoten(e).
knoten(f).
knoten(g).
knoten(h).
knoten(i).
knoten(j).
knoten(k).
knoten(l).
knoten(m).
knoten(n).
kante(a, b).
kante(a, c).
kante(a, d).
kante(b, f).
kante(c, e).
kante(d, f).
kante(e, f).
kante(f, g).
kante(g, h).
kante(h, i).
kante(h, j).
kante(i, j).
kante(j, k).
kante(j, l).
kante(j, m).
kosten(a, b, 2).
kosten(a, c, 5).
kosten(a, d, 7).
kosten(b, f, 9).
kosten(c, e, 1).
kosten(d, f, 5).
kosten(e, f, 2).
kosten(f, g, 7).
kosten(g, h, 18).
kosten(h, i, 7).
kosten(h, j, 6).
kosten(i, j, 1).
kosten(j, k, 1).
kosten(j, l, 2).
kosten(j, m, 5).
zweierkanten(X, Y) :- kante(X, Z), kante(Z, Y).
kostenpunkt(X, Y) :- kosten(X, Y, Z),
write(Z).
zweierkantenkosten(X, Y) :- kosten(X, B, Z), kosten(B, Y, M), K is Z+M, write(K).
verbindung(X, X).
verbindung(X, Y) :- kante(X, A),
verbindung(A, Y),
write(A).
%HIER LIEGT DAS PREOBLEM
vk(X, Y) :- findall(Summe, verbindungskosten(X, Y, 0, [Y], Summe),L), write(L).
%HIER LIEGT DAS PREOBLEM
verbindungskosten(X, X, S, Pfad, Summe) :- write('Kosten: '), write(Summe), write('\nPfad: '), write(Pfad), write('\n').
verbindungskosten(X, Y, S, Pfad, Summe) :- kosten(A, Y, Z),
N is S + Z,
append([A],Pfad,NeuerPfad),
verbindungskosten(X, A, N, NeuerPfad, N).
Ja Prolog, eine tolle Sprache, leider an der Uni relevant ...
Und zwar muss ich alle Lösungen irgendwie in L uebergeben, leider krieg ichs nicht hin :\