BiSarfraz
BiSarfraz

Reputation: 479

Star shaped network with directed links from center

I want to generate star topology of a network with directed links from the central node to the other nodes. I have created star network with links to the central node from the external nodes, but I am not able to direct the links from the centre to other nodes.

 directed-link-breed [Ls L]

 to star
   ca
   nw:generate-star turtles Ls 100 ; using link breed
   [
      set color red
      fd random 15
      set shape "circle"
      ask links [set color yellow]
   ]

   nw:generate-star turtles Ls-to 100 ; it does not work
end

Upvotes: 1

Views: 64

Answers (1)

Bryan Head
Bryan Head

Reputation: 12580

Unfortunately, there's no way to control the direction that nw:generate-star will generate the links in. However, it's quite easy to generate the star yourself:

to star
  ca
  create-turtles 100 [
    set color red
    fd random 15
    set shape "circle"
  ]
  ask turtle 0 [
    setxy 0 0 
    create-Ls-to other turtles [ set color yellow ]
  ]
end

Upvotes: 1

Related Questions