Rene Greulich
June 2nd, 1999, 11:04 AM
Hi,
I have to create a CBreadthSearch class for a university (FindTheBestFlight) project, but do not know how to start.
Therefore I need someone who can tell me a little bit about the breadth-search.
I have a prolog programm which does a breadth-search:
_________data_base____________________
edge(frankfurt, stuttgart).
edge(frankfurt, nuernberg).
edge(frankfurt, koeln).
edge(koeln, saarbruecken).
egde(stuttgart, saarbruecken).
.
.
.
_________programm_____________________
path_with_breadth_search(A, B, C):- //application
path_b([[A]], B, D),
reverse(D, C).
path_b([A|B], C, A):-
A = [C|D].
path_b([[A|B] | C], D, E):-
findall([F, A|B], possible_nodes(A, B,F), G)
append(C, G, H),
path_b(H, D, E).
possible_node(A, B, C):-
( edge(A, C)
;edge(C, A)
),
not member(C, B).
___________________________________
If you have an idea please tell me
thanks a lot
Rene Greulich
I have to create a CBreadthSearch class for a university (FindTheBestFlight) project, but do not know how to start.
Therefore I need someone who can tell me a little bit about the breadth-search.
I have a prolog programm which does a breadth-search:
_________data_base____________________
edge(frankfurt, stuttgart).
edge(frankfurt, nuernberg).
edge(frankfurt, koeln).
edge(koeln, saarbruecken).
egde(stuttgart, saarbruecken).
.
.
.
_________programm_____________________
path_with_breadth_search(A, B, C):- //application
path_b([[A]], B, D),
reverse(D, C).
path_b([A|B], C, A):-
A = [C|D].
path_b([[A|B] | C], D, E):-
findall([F, A|B], possible_nodes(A, B,F), G)
append(C, G, H),
path_b(H, D, E).
possible_node(A, B, C):-
( edge(A, C)
;edge(C, A)
),
not member(C, B).
___________________________________
If you have an idea please tell me
thanks a lot
Rene Greulich