Question: How might the equality of two hierarchical tables be checked ?

Hi everybody

I have two tables, namely A and B, the entries of wich can also be tables ... and so on.
These two tables have the same structure in the following sense :

Viewing A or B as tree graphs GA and GB :

  1.  the set of the names of the vertices of GA is identical to the set of the names of the vertices of GB
  2. GA and GB have the same connectivities

For instance A and B below share the same structure
A := table([x=table([u=1]), y=table([v=table([p=2]), w=3]) )]
B := table([ x=table([u=4]), y=table([v=table([p=12]), w=3]) )]

But not do A and C
C := table([x=table([u=1]), y=table(v=2, w=3]) )]


Let p(s) some path in GA from its root to some terminal leaf s.
B being "structurally identical" to A, GB also contains p(s)
Returning to the original tables, p(s) corresponds to a multi-index [k1][k2]...[kn] and the "value" of s is then given by A [k1][k2]...[kn]) or, symbolically A[p(s)]

I adopt this definition for "A = B" :
A is said to be equal to B iif the entry of A[p(s)] equals B[p(s)] for all the terminal leaves s
(here equals is intended in the "classical" senses, ie 3=3, {1,2}={2,1}, ...)
 

How can I check if "A=B" in the following sense ?

Thanks in advance

PS : Keeping in mind the analogy between A and GA, I have written a recursive procedure to check if A=B. But it is rather lengthy and I wondered if there could exist some Maple function to do this test ?


 

Please Wait...