Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get levels of BFS in Prolog

Status
Not open for further replies.

Agogel

Technical User
Jan 5, 2011
1
IT
Hello everybody, i'm new at prolog and to improve my skills i'm trying to make some exercise.
At the moment I'm stuck with a BFS, let assume the tree is something like this:

a
/\
b c
/\
d e

after my query i've something like

X=a;
X=b;
X=c;
X=d;
X=e;

or, at least:

X=a,b,c,d,e;

I'm wondering about how to have results ordered by depth levels as output, something like:

X=[a];
X=[b,c];
X=[d,e];

HEEEEELP

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top