From: Robert Klemme Date: 2008-11-20T23:27:17+09:00 Subject: Re: BFS in ruby from a hash 2008/11/20 Hugh Sasse : > > On Thu, 20 Nov 2008, equinox wrote: > >> Yes I know the algorithm of doing BFS, however I can't see where a >> hash is a graph structure... Well, isn't this (i.e. analyzing the problem) part of your assignment? This really looks like a homework assignment... >> How do I visit the child here? Which ones are trees in the same level? > > In the Pastie the keys point at arrays of strings. But in that example > all the strings correspond to keys, except for lonelygirl13 which looks > like a typo for the key lonelygirls13. Normally to make a tree with > hashes you'd use hashes of hashes [of hashes [...]]. It seems to me > you can't do Breadth first until you've got some Depth to not do first! Hugh, not necessarily. You just need to look at the Hash as a vertex collection. I'm not going to say more... :-) Kind regards robert -- remember.guy do |as, often| as.you_can - without end