NW:load-graphml seems to ignore random-seed

36 views
Skip to first unread message

Simone Gabbriellini

unread,
Aug 6, 2018, 6:37:39 AM8/6/18
to netlogo-users
Hello,

I am trying to process some network data using the nw extensions, and I am stuck with setting the seed in order to have reproducible runs.

If you create a network like this, you can set the random seed and every time you call the procedure you have a network in the same exact layout:


to setup
  ca
  random-seed 1
  create-turtles 100
  ask turtles [
    ask other turtles [
      if random-float 1 < 0.01 [
        create-link-with myself
      ]
    ]
  ]
  repeat 10 [layout-spring turtles links 0.2 5 1]
  nw:set-context turtles links
end

same applies if you create the network from scratch using the nw extension:

to setup2
  ca
  random-seed 1
  nw:generate-random turtles links 100 0.01
  repeat 10 [layout-spring turtles links 0.2 5 1]
  nw:set-context turtles links
end

however, if you try to load froma graphml file, every time you have the network with a different layout - and this applies with a graphml that I have generated as well as the graphml file used in the nw guide:

to setup3
  ca
  random-seed 1
  nw:load-graphml "random-exact-50-4-106.graphml"
  repeat 10 [layout-spring turtles links 0.2 5 1]
end

to setup4
  ca
  random-seed 1
  nw:load-graphml "prova.graphml"
  repeat 10 [layout-spring turtles links 0.2 5 1]
end

I am attaching a folder with the model example as well as the two graphml files used. Can anyone point me in the right direction? Is this a known problem?

Best,
Simone
bug with nw.zip
Reply all
Reply to author
Forward
0 new messages