-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstock model.nlogo
2041 lines (1856 loc) · 45 KB
/
stock model.nlogo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;; define breeds of turtles
breed [influencers influencer]
breed [traders trader]
;; variables of turtles
turtles-own[
sentiment
distance-from-other-turtles
turtle-component
node-clustering-coefficient
rd-index
]
;; variables of traders
traders-own[
balance
stock
news-sens
infl-sens
peer-sens
self-sens
net-worth
sign
close-to-infl?
num-neighbors
mean-net-worth-neighbors
influencer?
]
links-own[
rewired? ;; keeps track of whether the link has been rewired or not
link-component
]
;; global variables
globals[
clustering-coefficient ;; the clustering coefficient of the network; this is the
;; average of clustering coefficients of all turtles
average-path-length ;; average path length of the network
clustering-coefficient-of-lattice ;; the clustering coefficient of the initial lattice
average-path-length-of-lattice ;; average path length of the initial lattice
infinity ;; a very large number.
;; used to denote distance between two turtles which
;; don't have a connected or unconnected path between them
agent-string ;; message that appears on the node properties monitor
network-string
number-rewired ;; number of edges that have been rewired. used for plots.
rewire-one? ;; these two variables record which button was last pushed
rewire-all?
available-stock
stock-price
price-inc
news-sentiment
gini-coef ;; Gini index
lorenz-points ;; list of Lorenz points
price-list ;; list of price history
]
;;;;;;;;;;;;;;;;;;;;;;;;
;;; Setup Procedures ;;;
;;;;;;;;;;;;;;;;;;;;;;;;
to startup
set agent-string ""
set network-string ""
end
to setup
clear-all
set infinity 99999 ;; just an arbitrary choice for a large number
set-default-shape turtles "circle"
make-turtles
set stock-price 100
set price-inc 0.3
set available-stock 500
set number-rewired 0
set network-string ""
set agent-string ""
set price-list []
compute-networth
reset-ticks
end
to go
generate-news
perceive-sentiment
trade
compute-networth
update-appearance
update-lorenz-and-gini
update-neighbors-info
update-price-history
tick
if ticks mod 200 = 0 [
stop
]
end
to generate-news
set news-sentiment random-normal 0 0.5
if news-sentiment < -1 [ set news-sentiment -1 ]
if news-sentiment > 1 [ set news-sentiment 1 ]
end
to perceive-news
ask traders [
set sentiment (news-sentiment * news-sens * (1 - self-sens) + sentiment * self-sens)
]
end
to perceive-peer
ask traders [
let peer-sentiment mean [sentiment] of link-neighbors
set sentiment (peer-sentiment * peer-sens * (1 - self-sens) + sentiment * self-sens)
]
end
to perceive-sentiment
ask traders [
ifelse influencer?
[
set sentiment random-normal 0 0.5
]
[
let peer-mean 0
if count link-neighbors with [breed = traders] > 0
[ set peer-mean mean [sentiment] of link-neighbors with [breed = traders] ]
let infl-mean 0
if count link-neighbors with [breed = influencers]> 0
[ set infl-mean mean [sentiment] of link-neighbors with [breed = influencers] ]
set sentiment min (list 1 max (list -1 (news-sentiment * news-sens + peer-mean * peer-sens + infl-mean * infl-sens + sentiment * self-sens)))
]
]
ask influencers [
set sentiment random-normal 0 0.5
]
end
to trade
ask traders [
let trade-quantity 0
let trade-sign 1
if sentiment > 0.3 and balance > stock-price and available-stock > 0
[
set trade-quantity floor (sentiment / 0.3)
if compute-cost trade-quantity > balance
[
set trade-quantity (trade-quantity - 1)
]
set trade-quantity min (list available-stock trade-quantity)
]
if sentiment < -0.3 and stock > 0 and stock-price >= 1
[
set trade-quantity floor (abs sentiment / 0.3)
set trade-quantity min (list stock trade-quantity)
set trade-sign (- 1)
]
set stock (stock + trade-quantity * trade-sign)
let cost (stock-price * trade-quantity * trade-sign + trade-sign * price-inc * (trade-quantity * (trade-quantity - 1) / 2))
set balance (balance - cost)
set stock-price (stock-price + trade-sign * trade-quantity * price-inc)
set available-stock (available-stock - trade-sign * trade-quantity)
]
end
to update-price-history
set price-list lput stock-price price-list
end
to update-neighbors-info
ask traders with [breed = traders] [
ifelse (any? link-neighbors with [breed = traders])[
set mean-net-worth-neighbors mean [net-worth] of link-neighbors with [breed = traders]
][set mean-net-worth-neighbors -1000]
]
end
to-report compute-cost [trade-quantity]
report (stock-price * trade-quantity + price-inc * (trade-quantity * (trade-quantity - 1) / 2))
end
to-report compute-earn [trade-quantity]
report (stock-price * trade-quantity - price-inc * (trade-quantity * (trade-quantity - 1) / 2))
end
to compute-networth
ask traders [
set net-worth (balance + stock * stock-price)
]
end
to update-appearance
ask traders [
ifelse abs(sentiment) < 0.3
[ set color gray + 3 ]
[ ifelse sentiment > 0
[ set color green + 3 - 2 * floor((sentiment - 0.3) / 0.3)]
[ set color red + 3 - 2 * floor(- (sentiment + 0.3) / 0.3)]
]
set size 0.3 + net-worth / 2000
]
ask influencers [
ifelse abs(sentiment) < 0.3
[ set color gray + 3 ]
[ ifelse sentiment > 0
[ set color green + 3 - 2 * floor((sentiment - 0.3) / 0.3)]
[ set color red + 3 - 2 * floor(- (sentiment + 0.3) / 0.3)]
]
]
end
to make-turtles
if infl-sens-on? [
create-influencers num-influencer [
set color gray + 2
set size 2
set shape "star"
]
]
create-traders num-nodes [
set color gray + 2
ifelse news-sens-on?
[ set news-sens max (list -1 min (list 1 (random-normal news-sens-mean 0.2))) ]
[ set news-sens 0 ]
ifelse peer-sens-on?
[ set peer-sens max (list -1 min (list 1 (random-normal peer-sens-mean 0.2))) ]
[ set peer-sens 0]
ifelse infl-sens-on?
[ set infl-sens max (list -1 min (list 1 (random-normal infl-sens-mean 0.2)))]
[ set infl-sens 0]
ifelse (random-float 1) < contrarian-investing [
set sign -1
set news-sens (news-sens * sign)
set peer-sens (peer-sens * sign)
set infl-sens (infl-sens * sign)
] [ set sign 1 ]
set self-sens random-float 1
set balance 1000
set sentiment 0
set stock 10
set turtle-component 0
set influencer? false
]
let n 0
ask turtles [
set rd-index n
set n (n + 1)
]
end
;;;;;;;;;;;;;;;;;;;;;;;
;;; Main Procedure ;;;
;;;;;;;;;;;;;;;;;;;;;;;
;; update ;;
to update-lorenz-and-gini
; recompute value of gini-coefficient and the points in lorenz-points for the Lorenz and Gini-Index plots
let sorted-wealths sort [net-worth] of traders
let total-wealth sum sorted-wealths
let wealth-sum-so-far 0
let index 0
let c-turtles count traders
set gini-coef 0
set lorenz-points []
; plot the Lorenz curve -- along the way, we also calculate the Gini index
repeat c-turtles [
set wealth-sum-so-far (wealth-sum-so-far + item index sorted-wealths)
set lorenz-points lput ((wealth-sum-so-far / total-wealth) * 100) lorenz-points
set index (index + 1)
set gini-coef gini-coef + (index / c-turtles) - (wealth-sum-so-far / total-wealth)
]
end
to-report weekly-price-dev
ifelse length price-list < 7 [
report standard-deviation price-list
]
[
let len length price-list
let price-7-days sublist price-list (len - 7) len
report standard-deviation price-7-days
]
end
to-report mean-monthly-dev
ifelse length price-list > 90
[
let quarter last-n-items price-list 90
let devs []
set devs lput standard-deviation (sublist quarter 0 30) devs
set devs lput standard-deviation (sublist quarter 30 60) devs
set devs lput standard-deviation (sublist quarter 60 90) devs
report mean devs
]
[
report standard-deviation last-n-items price-list 30
]
end
to-report last-n-items [input-list n]
report sublist input-list (max list 0 (length input-list - n)) length input-list
end
;; network ;;
to rewire
;; make sure num-turtles is setup correctly; if not run setup first
if count turtles != num-nodes + num-influencer [
setup-lattice
]
;; set up a variable to see if the network is connected
let success? false
;; if we end up with a disconnected network, we keep trying, because the APL distance
;; isn't meaningful for a disconnected network.
while [not success?] [
;; kill the old lattice, reset neighbors, and create new lattice
ask links [ die ]
setup-lattice
ask links [
set rewired? false
;; whether to rewire it or not?
if (random-float 1) < rewiring-probability
[
;; "a" remains the same
let node1 end1
;; if "a" is not connected to everybody
if [ count link-neighbors ] of end1 < (count turtles - 1)
[
;; find a node distinct from node1 and not already a neighbor of node1
let node2 one-of turtles with [ (self != node1) and (not link-neighbor? node1) ]
;; wire the new edge
ask node1 [ create-link-with node2 [ set color cyan set rewired? true ] ]
set number-rewired number-rewired + 1 ;; counter for number of rewirings
set rewired? true
]
]
;; remove the old edge
if (rewired?)
[
die
]
]
;; check to see if the new network is connected and calculate path length and clustering
;; coefficient at the same time
set success? do-calculations
]
;; do the plotting
update-plots
end
to add-edges
let v1 0
while [v1 < count turtles - 1] [
let node1 turtle v1
ask node1 [
let v2 (v1 + 1)
while [v2 < count turtles] [
let node2 turtle v2
if not link-neighbor? node2 and (random-float 1) < connect-probability [
create-link-with node2
]
set v2 v2 + 1
]
]
set v1 v1 + 1
]
;; check to see if the new network is connected and calculate path length and clustering
;; coefficient at the same time
let success? do-calculations
;; do the plotting
update-plots
end
;; do-calculations reports true if the network is connected,
;; and reports false if the network is disconnected.
;; (In the disconnected case, the average path length does not make sense,
;; or perhaps may be considered infinite)
to-report do-calculations
;; set up a variable so we can report if the network is disconnected
let connected? true
;; find the path lengths in the network
find-path-lengths
let num-connected-pairs sum [length remove infinity (remove 0 distance-from-other-turtles)] of turtles
;; In a connected network on N nodes, we should have N(N-1) measurements of distances between pairs,
;; and none of those distances should be infinity.
;; If there were any "infinity" length paths between nodes, then the network is disconnected.
;; In that case, calculating the average-path-length doesn't really make sense.
ifelse ( num-connected-pairs != (count turtles * (count turtles - 1) ))
[
set average-path-length infinity
;; report that the network is not connected
set connected? false
]
[
set average-path-length (sum [sum distance-from-other-turtles] of turtles) / (num-connected-pairs)
]
;; find the clustering coefficient and add to the aggregate for all iterations
find-clustering-coefficient
set network-string (word "clustering-coefficient = " precision clustering-coefficient 2
", average-path-length = " precision average-path-length 2
", edges = " count links)
;; report whether the network is connected or not
report connected?
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Clustering computations ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to-report in-neighborhood? [ hood ]
report ( member? end1 hood and member? end2 hood )
end
to find-clustering-coefficient
ifelse all? turtles [count link-neighbors <= 1]
[
set clustering-coefficient 0
]
[
let total 0
ask turtles with [ count link-neighbors <= 1]
[ set node-clustering-coefficient "undefined" ]
ask turtles with [ count link-neighbors > 1]
[
let hood link-neighbors
set node-clustering-coefficient (2 * count links with [ in-neighborhood? hood ] /
((count hood) * (count hood - 1)) )
;; find the sum for the value at turtles
set total total + node-clustering-coefficient
]
;; take the average
set clustering-coefficient total / count turtles with [count link-neighbors > 1]
]
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Path length computations ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Implements the Floyd Warshall algorithm for All Pairs Shortest Paths
;; It is a dynamic programming algorithm which builds bigger solutions
;; from the solutions of smaller subproblems using memoization that
;; is storing the results.
;; It keeps finding incrementally if there is shorter path through
;; the kth node.
;; Since it iterates over all turtles through k,
;; so at the end we get the shortest possible path for each i and j.
to find-path-lengths
;; reset the distance list
ask turtles
[
set distance-from-other-turtles []
]
let i 0
let j 0
let k 0
let node1 one-of turtles
let node2 one-of turtles
let node-count count turtles
;; initialize the distance lists
while [i < node-count]
[
set j 0
while [j < node-count]
[
set node1 turtle i
set node2 turtle j
;; zero from a node to itself
ifelse i = j
[
ask node1 [
set distance-from-other-turtles lput 0 distance-from-other-turtles
]
]
[
;; 1 from a node to it's neighbor
ifelse [ link-neighbor? node1 ] of node2
[
ask node1 [
set distance-from-other-turtles lput 1 distance-from-other-turtles
]
]
;; infinite to everyone else
[
ask node1 [
set distance-from-other-turtles lput infinity distance-from-other-turtles
]
]
]
set j j + 1
]
set i i + 1
]
set i 0
set j 0
let dummy 0
while [k < node-count]
[
set i 0
while [i < node-count]
[
set j 0
while [j < node-count]
[
;; alternate path length through kth node
set dummy ( (item k [distance-from-other-turtles] of turtle i) +
(item j [distance-from-other-turtles] of turtle k))
;; is the alternate path shorter?
if dummy < (item j [distance-from-other-turtles] of turtle i)
[
ask turtle i [
set distance-from-other-turtles replace-item j distance-from-other-turtles dummy
]
]
set j j + 1
]
set i i + 1
]
set k k + 1
]
end
;;;;;;;;;;;;;;;;;;;;;;;
;;; Edge Operations ;;;
;;;;;;;;;;;;;;;;;;;;;;;
;; creates a new lattice
to setup-lattice
setup
;; iterate over the turtles
layout-circle (sort-on [rd-index] turtles) max-pxcor - 1
let nodes (sort-on [rd-index] turtles)
let n 0
while [n < count turtles]
[
;; make edges with the next two neighbors
;; this makes a lattice with average degree of 4
make-edge item n nodes
item ((n + 1) mod (count turtles)) nodes
make-edge item n nodes
item ((n + 2) mod (count turtles)) nodes
set n (n + 1)
]
update-edge-color
let success? do-calculations
end
to setup-scalefree
setup
let n 1
let nodes []
ifelse boost-influence?
[ set nodes (sort-on [who] turtles) ]
[ set nodes (sort-on [rd-index] turtles) ]
while [n < scalefree-edges + 1]
[
;; make edges with the next two neighbors
;; this makes a lattice with average degree of 4
ifelse n >= count turtles
[
let node1 find-partner
let node2 one-of turtles with [ (self != node1) and (not link-neighbor? node1) ]
;; wire the new edge
make-edge node1 node2
]
[
ifelse n > 1
[
let partner find-partner
make-edge partner (item n nodes)
]
[
let partner item 0 nodes
make-edge partner (item n nodes)
]
]
set n n + 1
]
update-edge-color
ask traders with [breed = traders] [
ifelse shape = "pentagon" [ set close-to-infl? True ] [ if shape = "circle" [ set close-to-infl? False ]]
ifelse any? link-neighbors [
set num-neighbors count link-neighbors
] [set num-neighbors 0]
]
let success? do-calculations
repeat 10 [ layout-tutte (turtles with [count link-neighbors > 4]) links 16 ]
end
to setup-disconnected-scalefree
setup
ask influencers [
set turtle-component (who mod 2)
]
ask traders [
ifelse who < 4
[
set turtle-component (who mod 2)
]
[
ifelse (who - 4) < component-ratio * (num-nodes - 4)
[
set turtle-component 0
]
[
set turtle-component 1
]
]
]
ask turtle 2 [
create-link-with turtle 0 [set link-component 0]
move-to turtle 0
; fd 5
]
ask turtle 3 [
create-link-with turtle 1 [set link-component 1]
move-to turtle 1
; fd 5
]
let n 4
while [n < scalefree-edges + 2]
[
;; make edges with the next two neighbors
;; this makes a lattice with average degree of 4
ifelse n >= count turtles
[
let node1 find-partner
let comp [turtle-component] of node1
let node2 one-of turtles with [ (turtle-component = comp) and (self != node1) and (not link-neighbor? node1) ]
;; wire the new edge
ask node1 [
create-link-with node2 [ set link-component comp ]
]
]
[
ask turtle n [
let comp turtle-component
let partner find-component-partner comp
create-link-with partner [set link-component comp]
move-to partner
]
]
set n n + 1
]
update-edge-color
let success? do-calculations
layout-circle (sort-on [turtle-component] turtles) max-pxcor - 1
end
to-report find-partner
report [one-of both-ends] of one-of links
end
to-report find-component-partner [component]
report [one-of both-ends] of one-of links with [link-component = component]
end
to update-edge-color
ask links [
set color gray - 1
ifelse ([breed] of end1 = traders) and ([breed] of end2 = traders)
[
if not peer-sens-on? [ set color gray - 3 ]
]
[
set color gray + 4
if ([breed] of end1 = traders) and ([breed] of end2 = influencers)
[
ask end1 [ set shape "pentagon" ]
]
if ([breed] of end2 = traders) and ([breed] of end1 = influencers)
[
ask end2 [ set shape "pentagon" ]
]
]
]
end
;; connects the two turtles
to make-edge [node1 node2]
ask node1 [ create-link-with node2 [
set rewired? false
] ]
end
;;;;;;;;;;;;;;;;
;;; Graphics ;;;
;;;;;;;;;;;;;;;;
to highlight
;; remove any previous highlights
update-appearance
ask links [ set color gray ]
if mouse-inside? [ do-highlight ]
display
end
to do-highlight
;; getting the node closest to the mouse
let min-d min [distancexy mouse-xcor mouse-ycor] of turtles
let node one-of turtles with [count link-neighbors > 0 and distancexy mouse-xcor mouse-ycor = min-d]
if node != nobody
[
;; highlight the chosen node
ask node
[
set color pink - 1
let pairs (length remove infinity distance-from-other-turtles)
let local-val (sum remove infinity distance-from-other-turtles) / pairs
;; show node's clustering coefficient
ifelse breed = traders
[
let adjusted-news-sens (news-sens + peer-sens * mean [news-sens] of link-neighbors with [breed = traders])
set agent-string (word "sens(n, p, p'n, s) = (" precision news-sens 1
", " precision peer-sens 1
", " precision adjusted-news-sens 1
", " precision self-sens 1
"), worth = " precision net-worth 1
", sent = " precision sentiment 1)
]
[
set agent-string (word "sentiment = " precision sentiment 1)
]
]
let neighbor-nodes [ link-neighbors ] of node
let direct-links [ my-links ] of node
;; highlight neighbors
ask neighbor-nodes
[
set color blue - 1
;; highlight edges connecting the chosen node to its neighbors
ask my-links [
ifelse (end1 = node or end2 = node)
[
set color blue + 1 ;
]
[
if (member? end1 neighbor-nodes and member? end2 neighbor-nodes)
[ set color yellow + 1]
]
]
]
]
end
@#$#@#$#@
GRAPHICS-WINDOW
274
20
632
379
-1
-1
10.0
1
10
1
1
1
0
0
0
1
-17
17
-17
17
1
1
1
ticks
30.0
SLIDER
13
288
156
321
num-nodes
num-nodes
10
125
50.0
1
1
NIL
HORIZONTAL
SLIDER
15
74
171
107
rewiring-probability
rewiring-probability
0
1
1.0
0.01
1
NIL
HORIZONTAL
BUTTON
184
74
259
107
NIL
rewire
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
MONITOR
266
393
637
438
node properties
agent-string
3
1
11
BUTTON
176
532
258
565
NIL
highlight
T
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
162
289
257
322
setup-lattice
setup-lattice
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
164
210
257
243
NIL
setup-scalefree
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
SLIDER
16
32
171
65
connect-probability
connect-probability
0
1
0.0
0.01
1
NIL
HORIZONTAL
BUTTON
185
32
258
65
NIL
add-edges
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
SLIDER
13
210
155
243
scalefree-edges
scalefree-edges
20
200
100.0
1
1
NIL
HORIZONTAL
BUTTON
13
532
76
565
NIL
go
T
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
88
533
163
566
go once
go