Re: Hash Table for self avoiding random walks

• To: mathgroup at smc.vnet.net
• Subject: [mg88500] Re: Hash Table for self avoiding random walks
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Tue, 6 May 2008 06:45:54 -0400 (EDT)
• Organization: The Open University, Milton Keynes, UK
• References: <fvmn1l\$8jn\$1@smc.vnet.net>

```jwmerrill at gmail.com wrote:

<snip>

> Googling <Mathematica Data Structures> led me to a nice article by
> Daniel Lichtblau: http://library.wolfram.com/infocenter/Conferences/321/
> , which shows how downvalues can be used in a similar way to hash
> tables.  The article is from 1999, though, and I'm wondering if it's
> still the state of the art.
>
> The idea is simple.  If I have a walk that took steps {{1,1},{1,2},
> {2,2}} then I make a function h:
>
> h[{1,1}] = True;
> h[{1,2}] = True;
> h[{2,2}] = True;
>
> My primary complaint with this technique is that it seems to require
> giving your hash table a name with global scope.  What if I want to
> make 100 different walks?  Do I have to give them all separate names?
> I guess I could do something like h[10][1,1] = True;, but then I
> always have to keep track of which walk I'm working on.  I'd rather
> just be able to let them all be anonymous and stick them in a list.
>
> Any ideas?

<snip>

Just an idea that pops up. You could use different contexts (with their
names automatically generated/discarded during each run) to store the
h[m,n] values.

See

*Contexts*
http://reference.wolfram.com/mathematica/tutorial/Contexts.html

*Manipulating Symbols and Contexts by Name*
http://reference.wolfram.com/mathematica/tutorial/ManipulatingSymbolsAndContextsByName.html

HTH,
-- Jean-Marc

```

• Prev by Date: Re: Problem: is not a list of numbers with dimensions
• Next by Date: Re: Interpolation with FourierTrigSeries with mathematica 6 tia sal2
• Previous by thread: Re: Hash Table for self avoiding random walks
• Next by thread: Re: Hash Table for self avoiding random walks