[comp.ai] Need help in Tree building routine - Problem stated clearly

skumar@cbnewsh.ATT.COM (swaminathan.ravikumar) (02/12/90)

I posted a question on tree building in Prolog a couple of days
back and I got replies saying that I did not convey the problem
clearly. First my apologies for the mistake. Here is the problem
again.

I want to construct a Prolog structure (possibly a list of list), 
and each element in the structure called "nodes" can be
connected to other nodes in the following way:

		one to one
		one to many
		many to one

To begin with I have the following facts asserted in the Prolog
Database:


	linked(a, b).         a     z
	linked(a, c).	     / \   /
	linked(b, d).       /   \ /
	linked(d, e).      b     c
	linked(c, e).      |     /
	linked(e, f).      d    /
	linked(e, g).       \  /
	linked(e, h).	      e
	linked(z, c).        /|\
	                    / | \
	                    f g  h

The structure I want to construct should also include information
such as the nodes that could be processed in parallel and
minimize repetition of nodes. For the above example I want
something like this:

        (
  	( ((a||z),c)		% I don't see a way to avoid
	||			% duplicating node "a"
	  (a,b,d)
	),
	e,
	(f||g||h)
	)

I have a version of this but it is clumsy because I don't have a
good notation (or operator) for representing parallel and
sequential processing. Any suggestions are welcome.

Thanks.

-- ravi
skumar@hocus.att.com