in reply to sql adjacency list

The best thing to do from an efficiency standpoint would be to have the entire database in memory at once, with pointers from each record to its "friend" records so access time is at a minimum. Barring this, a flatfile database with line numbers will work fine, as long as you sort in order the lines you need to access at each depth of recursion so seek times are at a minimum. A secondary file should be used for finding the line number corresponding to a name (necessary for starting things off by locating the first record) so the main file can reuse lines and not worry about staying in order.