From: Robert Klemme Date: 2008-11-20T16:31:17+09:00 Subject: Re: BFS in ruby from a hash On 20.11.2008 04:54, equinox wrote: > I want to do a breadth first search on a hash like below: > > http://pastie.org/319366 > > can anyone give me some idea where to start as I've never done bfs > (breadth first search) on hash before. http://en.wikipedia.org/wiki/Breadth-first_search#Algorithm_.28informal.29 If you just want to visit all nodes (i.e. not a search) then you need to remember all visited nodes and not put new nodes into the queue which you have seen already. Kind regards robert