crazy behaviour of graphs hash_table



On Mon, May 05, 2008 at 04:37:27PM -0400, Stavros Macrakis wrote:
> On Mon, May 5, 2008 at 12:51 PM, Oliver Kullmann
> <O.Kullmann at swansea.ac.uk> wrote:
> >  I'm using the hash-table from graph_core.lisp in the graphs-package....
> >  Now the above bug is explained: Entering a plain list [1,1] into the hash-table
> >  is not good enough, since it doesn't match with the original [1,1] which has
> >  these annotations....
> 
> This is an elementary problem.  When comparing two Maxima values for
> structural equality, all annotations in the cdar of the expression and
> its subexpressions should be ignored.  The "equal" operator is alike1:
> 
> :lisp (alike1 '((mplus Napoleon) 2 a) '((mplus Wellington) 2 a)) => T
> 
> Obviously if you hash the whole list structure including
> Napoleon/Wellington, you will get incorrect results.
> 
> >From your email, it sounds as though you're reusing the internals of
> the graph package, not the Maxima interface to the graph package.  Is
> that correct?

I don' understand what you mean:

I use load(graphs).

Now for example the function isomorphism
returns a "hash table", without saying what that
is. One example for using it is given, by
hash_table_data.

Now to make further use of it, I looked up
the other function hash_table, set_hash, get_hash.

I understand this as the Maxima interface.
Or is there some other?

  Perhaps the internals aren't designed for your
> application?

The definition of these four functions looks quite canonical to me.

>  Can you reproduce the problem using only the externally
> defined Maxima interfaces to the graph package?  If so, it would be
> very useful to communicate the exact scenario to the list.
>

Here is it:

load(graphs);
h : hash_table();

batch("File1");
batch("File2");
batch("File1");

where File1 is

get_hash([],h);

and File2 is

set_hash([],h,77);
get_hash([],h);

As you can see, from the external point the behaviour is
inconsistent. With print(h) one sees why.

> >  Is this behaviour common with Maxima??
> 
> Not sure what you mean by "this behavior".  Do you mean, "should I
> expect there to be bugs"?  Yes, as with any software package.  Note,
> too, that the graph package is part of the "contrib" directory, i.e.
> is not really part of Maxima itself, but is a contribution from a
> member of the community.
> 

>From all the packages the graphs-package is by far the most useful to me.
It seems also to me of in general high quality.

By the way, my question w.r.t "this behaviour" was not meant as
"is this buggy behaviour common", but "this behaviour" meant
the annotation of values with their creation-data.

Oliver