Skip to content

nw:load-graphml somehow messes with the random seed #187

@digitaldust

Description

@digitaldust

I think there is a problem with random seed if nw:load-graphml is invoked.

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 position:

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 from a 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

See also the discussion here to find a netlogo model and graphml files that demonstrate the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions