[Tutor] data structure and algorithm

Brad Reisfeld brad.reisfeld@colostate.edu
Tue, 26 Mar 2002 07:01:27 -0700


Hi,
I would appreciate some advice with regard to an algorithm and data
structure.

Suppose that I have a number of functions (f1,..., fn) each of which take a
'symbol' argument and return a list of such symbols. For example:

f1(A) = [B,C,D,E]
f2(B) = [F,G]
f2(C) = [H,I,J]
f3(G) = [K,L,B,N]

After applying the functions in a certain way, I would like to enumerate the
'linkage' between the various symbols. Each 'symbol' may not be unique, and
may appear at various points in a 'chain'.

For the example above, this linkage might be represented as

A -> B -> F
A -> B -> G -> K
A -> B -> G -> L
A -> B -> G -> B
A -> B -> G -> N
A -> C -> H
A -> C -> I
A -> C -> J
A -> D
A -> E

Although it is not necessary, it might be useful to have the functions
applied for each item enumerated as well, e.g.
	A -> B -> F : (f1,f2)   or	A --f1--> B --f2--> F

I'm not a computer scientist, but this seems as if this is basically a tree
structure in which we are moving from the 'trunk' to a given 'leaf'. Perhaps
this is something related to directory 'walking'.

Does anyone have any ideas as to how I should code this structure and
algorithm?

Thanks for your help.

-Brad