Submitted by raevnos on Mon, 2008-01-21 07:44

Tonight I was working on a new tree data structure. It's been a long time since I'd written such a beast -- I've been in the habit of re-using existing ones -- but I didn't see any implementations of the particular structure I wanted to use that met my requirements, and, well... it has been a long time. Need the practice.

At one point in debugging, I was thinking that it would be nice to be able to see the entire tree laid out graphically, and see how that changes as things get inserted and deleted.

After some poking around, I found Graphviz, a set of graph-rendering tools put out by AT&T that was easy to use. Example png. (If you're familiar with patricia/radix trees, you'll notice something odd about that. I'm playing around.)

What did I need this for? A way to map integers to arbitrary data. I could have used the existing hash table code pretty easily... but that wouldn't have been fun.

Why use integer keys? A couple of things: The main one that I'm also working on is queue process ids (queue pids, cupids... hah! I kill me!). Inspired by Rhost, @halt/pid will let you cancel a single @wait or semaphore. Rhost has some other cupid-related commands I'll be adding too.
Integer maps will be handy for a few other places, too -- commands like @pemit/port that act on socket descriptors, and possibly in command switch testing, and in the linux inotify-based() help file auto-reindexing I recently committed. Maybe some other places.