Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weak-component-clusters not honoring context? #85

Closed
nicolaspayette opened this issue Oct 11, 2013 · 1 comment
Closed

weak-component-clusters not honoring context? #85

nicolaspayette opened this issue Oct 11, 2013 · 1 comment
Assignees
Labels
Milestone

Comments

@nicolaspayette
Copy link
Member

Uncovered by @arthurhjorth.

Minimalish test case:

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)]
@ghost ghost assigned nicolaspayette Oct 11, 2013
@arthurhjorth
Copy link
Member

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants