NetLogo Nw Extension
首先我们需要理解的是,为了使用network extension,如何告诉extension要使用哪个network。先考虑下面例子中的情形:
breed [ bankers banker ]
breed [ clients client ]
undirected-link-breed [ friendships friendship ]
directed-link-breed [ accounts account ]
基本上,我们有银行家和顾客。顾客和银行家之间通过账户联系。银行家之间也可以通过账户联系,任两个人之间都可以成为朋友。
现在,我们或许会想到将整个事情当作一个大网络。默认地,NW extension原语考虑所有的海龟和连边当作网络的一部分。
然而,我们或许只对网络中的朋友关系感兴趣。进一步地,我们只对银行家之间的朋友关系感兴趣。为了具体化这种网络,我们需要告诉extension我们对哪些海龟和连边感兴趣。
一些例子:
- nw:set-context turtles links will give you everything: bankers and clients, friendships and accounts, as one big network.
- nw:set-context turtles friendships will give you all the bankers and clients and friendships between any of them.
- nw:set-context bankers friendships will give you all the bankers, and only friendships between bankers.
- nw:set-context bankers links will give you all the bankers, and any links between them, whether these links are friendships or accounts.
- nw:set-context clients accounts will give you all the clients, and accounts between each other, but since in our fictional example clients can only have accounts with bankers, this will be a completely disconnected network.