how to create links with neighors' links-neighbors

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

how to create links with neighors' links-neighbors

Bing Zhnag
Dear all:

I want to create links to neighbor’s link-neighbors.

My codes are as follows:

 

ask turtles [

create-links-to [link1-neighbors] of turtles-on neighbors

]

 

It seems no work.

Pls give me some suggestion. Thanks

 

Best regards.

-------------------------------------------------------------------------

Zhang Bing  

Ph.D. candidate

Center of Environmental Management and Policy

School of Environment, Nanjing University

22 Hankou Road, Nanjing 210093, P.R.China

江苏省南京市汉口路22号南京大学环境学院

Tel/Fax: 86-25-83595207

Cellphone: 13951722047(China); 848-482-0692(US)  

 <mailto:E-mail:[hidden email]> E-mail:[hidden email];
<mailto:[hidden email]> [hidden email]

---------------------------------------------------------------------------

 

Reply | Threaded
Open this post in threaded view
|

Re: how to create links with neighors' links-neighbors

James Steiner-2
That's because create-links-to will not accept a list as input. You
need an agentset.

So, converting the list that [...] of ... creates into an agentset should work:

create-links-to (turtle-set [link1-neighbors] of turtles-on neighbors )

Note that if one of those turtles already has a link to this turtle, I
think an error occurs.

~~James

2008/5/17 Bing Zhnag <[hidden email]>:

> Dear all:
>
> I want to create links to neighbor's link-neighbors.
>
> My codes are as follows:
>
>
>
> ask turtles [
>
> create-links-to [link1-neighbors] of turtles-on neighbors
>
> ]
>
>
>
> It seems no work.
>
> Pls give me some suggestion. Thanks
>
>
>
> Best regards.
>
> -------------------------------------------------------------------------
>
> Zhang Bing
>
> Ph.D. candidate
>
> Center of Environmental Management and Policy
>
> School of Environment, Nanjing University
>
> 22 Hankou Road, Nanjing 210093, P.R.China
>
> 江苏省南京市汉口路22号南京大学环境学院
>
> Tel/Fax: 86-25-83595207
>
> Cellphone: 13951722047(China); 848-482-0692(US)
>
> E-mail:[hidden email]; [hidden email]
>
> ---------------------------------------------------------------------------
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: how to create links with neighors' links-neighbors

SethTisue
Administrator
>>>>> "James" == James Steiner <[hidden email]> writes:

 James> create-links-to (turtle-set [link1-neighbors] of turtles-on
 James> neighbors )

 James> Note that if one of those turtles already has a link to this
 James> turtle, I think an error occurs.

You're probably thinking of an old 4.0 beta, there.  In the final
NetLogo 4.0 release, the link creation primitives simply ignore
requests to create links that already exist.

--
Seth Tisue / http://tisue.net
lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/