swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help on the use of the Graph library


From: Fabio Mascelloni
Subject: Help on the use of the Graph library
Date: Wed, 31 Mar 1999 10:25:00 +0200

I've tried to use the Graph library in my simulation, but some tasks
still remain obscure to me: the graph I've to draw on the canvas in
represented by a square matrix in which element [i][j]==1 if node i and
j must be linked toghether ,[i][j]==0
otherwise.
In each simulation step ,if [i][j]==1 and a link doesn't already
exists,it is created.If
[i][j]==0 and a link is present,it is removed.
I've implemented the first case in this way

if ( graph[i][j] )
    if (!([[gnodeList atOffset: i ] linkedTo:[gnodeList atOffset: j ]]
|| [ [gnodeList  atOffset:i] linkedFrom: [ gnodeList atOffset:j ]]))
                       [agGraph addLinkFrom:[gnodeList atOffset: idx]
To:[gnodeList atOffset:idx2]];

What I don't have perfectly understood  is how to remove a link between
two nodes.It seems to me that a predefined method to return a certain
link doesn't exist.I mean a method of this kind:

- getLinkFrom: abj1 To: obj2

so I'd write

id aLink;
aLink = getLinkFrom: obj1 To:obj2
[aLink drop];

What kind of solution do you suggest me ?
Fabio.




                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]