Hi Nick
I was getting errors in the "set all-node-coordinates " saying it
expects two inputs . I tried assigning only one coordinate too to see
what was happeneing , but it is still with the same problem . I shall
try the new code fragment to see what was wrong . Thanks.
Sandhya
--- In netlogo-users%40yahoogroups.com">netlogo-users
yahoogroups.com, "Nick" <nickbenn
...> wrote:
>
> Sandhya,
>
> This is the complete code I used to test the fragment I posted. It
runs
> fine for me.
> globals [
> node-coordinates
> ]
>
> breed [
> nodes node
> ]
>
> to setup
> clear-all
> setup-globals
> setup-nodes
> end
>
> to setup-globals
> set node-coordinates [
> [ 14.42 7.12]
> [ -4.47 -5.67]
> [ 7.88 12.29]
> [ 2.80 -1.07]
> [-12.36 1.88]
> [ 16.31 -6.01]
> [-12.91 9.70]
> [ 2.36 14.62]
> [ 1.07 -6.46]
> [-13.92 1.99]
> ]
> end
>
> to setup-nodes
> create-nodes (length node-coordinates) [
> let coordinate-pair (first node-coordinates)
> set node-coordinates (but-first node-coordinates)
> setxy (first coordinate-pair) (last coordinate-pair)
> ]
> end
> What sort of errors are you seeing?
>
> Regards,
>
> Nick
>
>
> --- In netlogo-users%40yahoogroups.com">netlogo-users
yahoogroups.com, "arunachalamsandhya"
> <arunachalamsandhya
> wrote:
> >
> > Hi Nick
> >
> > Is there any information missing in the hint that you gave me . I
am
> > getting a lot of errors or may be I am making some mistake .
> >
> > Thanks
> >
> > Sandhya
> >
> > --- In netlogo-users%40yahoogroups.com">netlogo-users
yahoogroups.com, "arunachalamsandhya"
> > arunachalamsandhya
wrote:
> > >
> > > Hi Nick
> > >
> > > Thanks for the help . This is a great group.
> > >
> > > Sandhya
> > >
> > > --- In netlogo-users%40yahoogroups.com">netlogo-users
yahoogroups.com, "Nick" <nickbenn
> wrote:
> > > >
> > > >
> > > > Sandhya,
> > > >
> > > > That's very straightforward to do, particularly if you have
the
> > > desired
> > > > X and Y coordinates for your nodes in a list (or a list of
lists).
> > > >
> > > > For example, assume that you have a global variable called
> > > > all-nodes-coordinates, and that its value is a list of XY
> > coordinate
> > > > pairs (with each coordinate pair specified as a list), e.g.:
> > > > set all-nodes-coordinates [
> > > > [ 14.42 7.12]
> > > > [ -4.47 -5.67]
> > > > [ 7.88 12.29]
> > > > [ 2.80 -1.07]
> > > > [-12.36 1.88]
> > > > [ 16.31 -6.01]
> > > > [-12.91 9.70]
> > > > [ 2.36 14.62]
> > > > [ 1.07 -6.46]
> > > > [-13.92 1.99]
> > > > ]
> > > > (You could also use file-read to read a list of coordinate
pairs
> > > like
> > > > this from a file; that's almost certainly a better approach
than
> > the
> > > > literal assignment above, especially for 100 nodes.)
> > > >
> > > > Also, let's assume there's a breed called nodes. The following
> > > statement
> > > > would then use all-nodes-coordinates to create one node for
each
> > > > coordinate pair, and place that node on the specified XY
> > > coordinates:
> > > > create-nodes (length all-nodes-coordinates) [
> > > > let coordinate-pair (first all-nodes-coordinates)
> > > > set all-nodes-coordinates (but-first all-nodes-
coordinates)
> > > > setxy (first coordinate-pair) (last coordinate-pair)
> > > > ]
> > > > Note that this statement uses the number of elements in
> > > > all-nodes-coordinates to determine the number of nodes
required,
> > and
> > > > creates those nodes. Each of those newly created nodes, in
turn,
> > > takes
> > > > the first pair of coordinates from all-nodes-coordinates
(popping
> > > that
> > > > pair from the list, so that the next node to do this will
work on
> > > the
> > > > next pair of coordinates), and use the two values in the pair
as
> > > its X
> > > > and Y position.
> > > >
> > > > I hope this helps!
> > > >
> > > > Regards,
> > > >
> > > > Nick Bennett
> > > >
> > > >
> > > > --- In netlogo-users%40yahoogroups.com">netlogo-users
yahoogroups.com, "arunachalamsandhya"
> > > > <arunachalamsandhya
> wrote:
> > > > >
> > > > > Hi
> > > > >
> > > > > I have created the nodes and links and have turtles walking
> > > between
> > > > > them, but the nodes are positioned randomly . I want to
specify
> > > where
> > > > > the node(i.e x and y co-ordinates for say 100 nodes) should
> > > be ,please
> > > > > help me .
> > > > >
> > > > > Thanks
> > > > >
> > > > > Sandhya
> > > > >
> > > >
> > >
> >
>
.