Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!umich!samsung!zaphod.mps.ohio-state.edu!rpi!fargo From: fargo@pawl.rpi.edu (Irwin M. Fargo) Newsgroups: comp.ai Subject: Re: m-way tree building Keywords: m-way trees Message-ID: Date: 11 Feb 90 22:24:29 GMT References: <8053@cbnewsh.ATT.COM> Organization: Fargo HQ, Inc. Lines: 38 In article <8053@cbnewsh.ATT.COM> skumar@cbnewsh.ATT.COM (swaminathan.ravikumar) writes: > >I have the following facts asserted in the prolog database: > > linked(a, b). > linked(a, c). > linked(b, d). > linked(b, e). > linked(b, f). > >and I want to construct an "m-way" tree strcuture as follows: > > a > | > ------- > | | > b c > | > ----- > | | | > d e f > Instead of using Prolog predicates to link the elements, you might want to use Prolog lists. The book I used when learning Prolog (Knowledge Systems & Prolog, edited by Adrian Walker), showed how lists can be interpreted as a tree structure. You might want to take a look at a good text on Prolog. You can also create n-way trees in languages like C and Pascal by using linked lists. Hope this helps. -- Thank you and happy hunting! Actually: Ethan M. Young ____ [> SB <] "Travel IS life" Internet: fargo@pawl.rpi.edu /__ -=>??<=- - Irwin M. Fargo Bitnet (??): usergac0@rpitsmts.bitnet / ARGO : 3000 years of regression from the year 4990