You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
extensions [ nw ]
undirected-link-breed [ roads road ]
undirected-link-breed [ railroads railroad ]
undirected-link-breed [ highways highway ]
to setup
ca
ask n-of 10 patches with [ pxcor < 0 and pycor < 0 ] [ sprout 1 [ set color red ] ]
ask n-of 10 patches with [ pxcor > 0 and pycor < 0 ] [ sprout 1 [ set color green ] ]
ask n-of 10 patches with [ pxcor > 0 and pycor > 0 ] [ sprout 1 [ set color blue ] ]
ask turtles [ create-roads-with other turtles with [ color = [ color ] of myself ] ]
ask one-of turtles with [ color = red ] [
create-railroad-with one-of turtles with [ color = blue ] [
set color yellow
]
]
ask one-of turtles with [ color = green ] [
create-highway-with one-of turtles with [ color = blue ] [
set color pink
]
]
end
And then:
observer> nw:set-context turtles (link-set roads railroads)
observer> show nw:weak-component-clusters
observer: [(agentset, 30 turtles)]
observer> ask highways [ die ]
observer> show nw:weak-component-clusters
observer: [(agentset, 20 turtles) (agentset, 10 turtles)]
The text was updated successfully, but these errors were encountered:
Just ran a test on the setting context. I wanted to see if the context only contained the links that I wanted it to - i.e. that the problem wasn't that the context was being set to something that it shouldn't have been. I hope the log below should make sense on its own, and it basically just confirms that the context is correct- it only contains what it should. But still the weak component clusters treats them as one.
It doesn't tell you anything you/we didn't already know, but I did it and wanted to share just so you don't try it too. :)
observer> show length item 0 nw:get-context
observer: 47
observer> show length item 1 nw:get-context
observer: 69
observer> show count intersections
observer: 47
observer> show count links
observer: 69
observer> nw:set-context intersections (link-set railroads roads)
observer> show length item 0 nw:get-context
observer: 47
observer> show length item 1 nw:get-context
observer: 68
observer> ask [my-component intersections (link-set railroads roads)] of one-of intersections [set color blue st]
the my-component now prints out a count of item 1 of the context (i.e. links) before and after painting them blue. They come out both as 68 which is correct.
(intersection 9): 68
(intersection 9): 68
(agentset, 47 turtles)
Uncovered by @arthurhjorth.
Minimalish test case:
And then:
The text was updated successfully, but these errors were encountered: