From: Robert Klemme Date: 2004-05-07T00:18:58+09:00 Subject: Re: model for my problem (network simulator) "Zsban Ambrus" schrieb im Newsbeitrag news:20040506132651.GB3743@math.bme.hu... > On Thu, May 06, 2004 at 10:05:29PM +0900, Gergely Kontra wrote: > > On 0504, Robert Klemme wrote: > > > > > > > I'd like to ask for help for my problem. Maybe the Q isn't > > > > ruby-specific, but I WILL implement it in ruby, and I want to make a > > > > rubyish program. I hope I can learn from the problem. > > "rubyish program" -- does this mean a program in ruby? probably since > you post this here > > > > > > > > > So: I had to write a network simulator. It consists of nodes, link > > > > between nodes. > > > >.... > > > > > > > > Shall I submit my code? Or did anybody has a model for it already? > > > > > > What was your question exactly? You seem to have implemented the simulator > > > already... > > > > Just one little thing (chicken-egg problem): the links should know about > > the 2 ending nodes, and nodes must know about in/outgoing links. So how > > to easily administrate it? > > That's easy in ruby, as ruby is garbage-collected, so it can clean up > circular references by itself. Thus, you can add a list of both the in and > outgoing links to each nodes. IMHO the question was rather how to manage those references so that they are always in sync. That would be the typical problem with bi directional references in OO languages. Typically you manually have to write code for that (unless you find a library that does it gracefully) but if done properly you need to do it only once and can then reuse that code. robert