-
Notifications
You must be signed in to change notification settings - Fork 2
/
Social Network Model.nlogo
1287 lines (1127 loc) · 33.3 KB
/
Social Network 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
;extensions [array table]
;;;;; creating the users breed ;;;;;
breed[users user]
users-own[
;;;;;;attributes values -----------------------------------------------------
age
gender
university
country
current-city
my-interest
my-language
my-relationship-status
privacy-concern
my-friendship-threshold
my-maximum-degree
settings-configured?
;;;;;;privacy settings -----------------------------------------------------
age-visibility
gender-visibility
university-visibility
country-visibility
current-city-visibility
interests-visibility
language-visibility
relationship-status-visibility
]
;;;;; creating globals ;;;;;
globals [genders universities countries cities interests languages relationship-status privacy-settings attributes-weights is-random-data ]
;;;;; initializing globals ;;;;;
to intitialize-globals
set genders ["male" "female"] ;; 2
set universities ["UCT" "UP" "UWC" "Wits" "Rhodes"] ;; 5
set countries ["south-africa" "sudan" "nigeria" "france" "canada" "Swaziland" "kenya" "cuba" "ghana"] ;; 9
set cities ["khartoum" "cape-town" "Johannesburg" "Durban" "Pretoria" "Mhluzi" "Port-Elizabeth"] ;; 7
set interests ["music" "sports" "reading" "dance" "programming" "traveling" "theater" "cinema"] ;; 8
set languages ["arabic" "english" "french" "xhosa" "zulu" "afrikaans"] ;; 6
set relationship-status ["single" "in-a-relationship" "married" "engaged"] ;; 4
set privacy-settings ["public" "friends-of-friends" "friends" "only-me"]
end
;;;;; setting up the simulation ;;;;;
to setup
ca ;; clearing all variables
reset-ticks
intitialize-globals ;; initializing globals
set is-random-data false
;; now creating the agents (i.e. users)
create-users num-users [
setxy random-xcor random-ycor
set shape "circle"
set color red
set age ceiling abs random-normal 30 5 ;;the age is given by a gaussian with mean 30 and variance 5
set gender item (random 2) genders ;; random gender
set university item (random 5) universities ;; random university
set country item (random 9) countries ;; random country
set current-city item (random 7) cities ;; random city
set my-interest item (random 8) interests ;; random interest
set my-language item (random 6) languages ;; random language
set my-relationship-status item (random 4) relationship-status ;; random relationship status
set privacy-concern abs random-normal .5 .15 ;; setting the privacy concern to a gaussian with mean .5 and variance ,15
set my-friendship-threshold abs random-normal .5 .15 ;; setting the friendship threshold to a gaussian with mean .5 and variance ,15
set my-maximum-degree ceiling abs random-normal 0 10 ;; setting the maximum degree to a gaussian with mean 0 and variance 15
set settings-configured? false
;;;; default privacy settings ----------------------------------------
set age-visibility "public"
set gender-visibility "public"
set university-visibility "public"
set country-visibility "public"
set current-city-visibility "public"
set interests-visibility "public"
set language-visibility "public"
set relationship-status-visibility "public"
set is-random-data false
]
end
;;;;; counting friend-in-common ;;;;;
to-report friend-in-common [source dest]
let result 0 ;; initially no friends in common
let flag false
ask [link-neighbors] of source
[
set flag true
if (member? dest link-neighbors) [set result result + 1] ;; counting the number of friend-in-common
]
ifelse flag [report result / count [link-neighbors] of source][report 0]
end
;;;;; forming the graph ;;;;;
to form-graph
tick
set-current-plot "No. Users who Configured Their Settings"
clear-plot
layout-spring users links .5 10 5 ;; making the layout of the graph
ask users [
;;------------------------------------------------
if( (count link-neighbors) <= my-maximum-degree)[
let me self
let possible-friends other turtles with [not member? self [link-neighbors] of me]
let new-friend one-of possible-friends
let mutual-friends-percentage friend-in-common me new-friend
let attribute-similarity similarity me new-friend
let frienship-score ( (.7 * attribute-similarity) + (.3 * mutual-friends-percentage) )
if ( frienship-score >= [my-friendship-threshold] of me) [
create-link-with new-friend
]
]
]
if(not any? users with [ (count link-neighbors) <= my-maximum-degree]) [stop]
end
;;;;; similarity function ;;;;;
to-report similarity [me otheruser]
let sim-result 0 ;; initializing the similarity result
if ([age] of me = [age] of otheruser ) [set sim-result sim-result + 1]
if ([gender] of me = [gender] of otheruser ) [set sim-result sim-result + 1]
if ([university] of me = [university] of otheruser ) [set sim-result sim-result + 1]
if ([country] of me = [country] of otheruser ) [set sim-result sim-result + 1]
if ([current-city] of me = [current-city] of otheruser ) [set sim-result sim-result + 1]
if ([my-interest] of me = [my-interest] of otheruser ) [set sim-result sim-result + 1]
if ([my-language] of me = [my-language] of otheruser ) [set sim-result sim-result + 1]
if ([my-relationship-status] of me = [my-relationship-status] of otheruser ) [set sim-result sim-result + 1]
if ( ([privacy-concern] of me - [privacy-concern] of otheruser) < .05 ) [set sim-result sim-result + 1]
set sim-result sim-result / 9 ;; similarity percentage
report sim-result
end
;;;;; simulating privacy settings configration ;;;;;
to simulate-privacy-settings
ifelse (count users with [ not settings-configured? ] >= 10) [
tick
ask n-of (random 10) users with [ not settings-configured? ] [
set color yellow
;; calculating user's motivation
let friends-who-configuered-settings 0
if any? link-neighbors [ set friends-who-configuered-settings (count link-neighbors with [settings-configured?] / count link-neighbors ) ]
let motivation ( alpha * privacy-concern + beta * friends-who-configuered-settings ) ;------------------------------------------------------------------------some upgrades needed---------------------------------------------------------------
ifelse motivation >= 0.30 [ configure-privacy-settings self][ set color red ]
]
][stop]
end
;;;;; configure privacy settings ;;;;;
to configure-privacy-settings [ selected-users ]
ask selected-users [
set age-visibility get-settings-value ( (alpha * privacy-concern) + (beta * age-weight) )
set gender-visibility get-settings-value ( (alpha * privacy-concern) + (beta * gender-weight) )
set university-visibility get-settings-value ( (alpha * privacy-concern) + (beta * university-weight) )
set country-visibility get-settings-value ( (alpha * privacy-concern) + (beta * country-weight) )
set current-city-visibility get-settings-value ( (alpha * privacy-concern) + (beta * current-city-weight) )
set interests-visibility get-settings-value ( (alpha * privacy-concern) + (beta * interest-weight) )
set language-visibility get-settings-value ( (alpha * privacy-concern) + (beta * language-weight) )
set relationship-status-visibility get-settings-value ( (alpha * privacy-concern) + (beta * relationship-weight) )
set color white
set settings-configured? true
]
end
;;;;; get settings value ;;;;;
to-report get-settings-value [ input ]
if ( input >= 0 and input <= 0.25) [report item 0 privacy-settings]
if ( input > 0.25 and input <= 0.5) [report item 1 privacy-settings]
if ( input > 0.50 and input <= 0.75) [report item 2 privacy-settings]
if ( input > 0.75 ) [report item 3 privacy-settings]
end
;;;;; temporary function ----------------------------------------------------------
to reset
ask users [
set settings-configured? false
set age-visibility "public"
set gender-visibility "public"
set university-visibility "public"
set country-visibility "public"
set current-city-visibility "public"
set interests-visibility "public"
set language-visibility "public"
set relationship-status-visibility "public"
set color red
]
set-current-plot "No. Users who Configured Their Settings"
clear-plot
end
;;;;; statistics ;;;;;
to-report average-degree
report round ( mean [(count link-neighbors)] of users )
end
to-report max-degree
report max [(count link-neighbors)] of users
end
to-report min-degree
report min [(count link-neighbors)] of users
end
to-report no-of-friendships
report sum [(count link-neighbors)] of users / 2
end
;;;;; descritizing settings value ;;;;;
to-report convert-setting [setting-value]
ifelse (setting-value = "public" or setting-value = "friends-of-friends") [report 0][report 1]
end
;;;;; generating random privacy settings ;;;;;
to random-settings
setup
set is-random-data true
ask users [
set age-visibility item (random 4) privacy-settings
set gender-visibility item (random 4) privacy-settings
set university-visibility item (random 4) privacy-settings
set country-visibility item (random 4) privacy-settings
set current-city-visibility item (random 4) privacy-settings
set interests-visibility item (random 4) privacy-settings
set language-visibility item (random 4) privacy-settings
set relationship-status-visibility item (random 4) privacy-settings
set settings-configured? true
set color white
]
end
;;;;; exporting simulation data ;;;;;
to export-gexf
let time date-and-time
set time (word substring date-and-time 0 8 "@" substring date-and-time 16 27)
set time replace-item 2 time "-"
set time replace-item 5 time "-"
let extention ""
let rand ""
let graph-file-name (word "Exported Files\\graph-[" num-users "]-" time ".gexf")
if (output-file-type = "weka-arff") [
set extention ".arff"
]
if (output-file-type = "csv" or output-file-type = "csv-IRT") [
set extention ".csv"
]
if (output-file-type = "general") [
set extention ".txt"
]
if(is-random-data) [set rand "random-"]
let dataset-file-name (word "Exported Files\\" rand "dataset-[" num-users "]-" time); extention)
;;;;---------------------------------------------gephi graph file ---------------------------------------------;;;
file-open ( graph-file-name )
file-print (word "<?xml version=" "\"""1.0""\"" " encoding=" "\"""UTF-8""\"" "?>")
file-print (word "<gexf" " xmlns=" "\"""https://people.cs.uct.ac.za/~aabuelgasim""\"""" " version= " "\""1.2"\"" " >")
file-print (word "<meta lastmodifieddate=" "\""timer"\"" " >" )
file-print (word "<creator>Ammar M. Abuelgasim</creator>")
file-print (word "<description> Simulated Social Network Dataset </description>")
file-print (word "</meta>")
file-print (word "<graph mode=" "\"""static" "\""" defaultedgetype=" "\"""undirected""\"" ">")
file-print "<nodes>"
ask users [
file-print (word "<node id=" "\""who"\"" " label=" "\""who"\"" " />")
]
file-print "</nodes>"
file-print "<edges>"
let link-counter 0
ask links [
file-print (word "<edge id=" "\""link-counter"\"" " source=" "\""[who] of end1"\"" " target=" "\"" [who] of end2 "\"" " />")
set link-counter link-counter + 1
]
file-print "</edges>"
file-print "</graph>"
file-print "</gexf>"
file-close
;;;;---------------------------------------------gephi graph file end-----------------------------------------;;;
;;;;---------------------------------------------the arff file------------------------------------------------;;;
if (output-file-type = "weka-arff" or output-file-type = "all") [
file-open( (word dataset-file-name ".arff" ))
;file-print (word "@relation " "Simulated-Dataset-[" time "] \r\n" )
file-print (word "@relation " "Simulated-" (substring dataset-file-name 15 49) " \r\n" )
file-print " \r\n"
;;feature attributes
file-print (word "@attribute age real \r\n")
file-print (word "@attribute gender {male, female} \r\n")
file-print (word "@attribute university {UCT, UP, UWC, Wits, Rhodes} \r\n")
file-print (word "@attribute country {south-africa, sudan, nigeria, france, canada, Swaziland, kenya, cuba, ghana} \r\n")
file-print (word "@attribute current-city {khartoum, cape-town, Johannesburg, Durban, Pretoria, Mhluzi, Port-Elizabeth} \r\n")
file-print (word "@attribute my-interest {music, sports, reading, dance, programming, traveling, theater, cinema} \r\n")
file-print (word "@attribute my-language {arabic, english, french, xhosa, zulu, afrikaans} \r\n")
file-print (word "@attribute my-relationship-status {single, in-a-relationship, married, engaged} \r\n")
;;class attributes
file-print (word "@attribute age-visibility {public, friends-of-friends, friends, only-me} \r\n")
file-print (word "@attribute gender-visibility {public, friends-of-friends, friends, only-me} \r\n")
file-print (word "@attribute university-visibility {public, friends-of-friends, friends, only-me} \r\n")
file-print (word "@attribute country-visibility {public, friends-of-friends, friends, only-me} \r\n")
file-print (word "@attribute current-city-visibility {public, friends-of-friends, friends, only-me} \r\n")
file-print (word "@attribute interests-visibility {public, friends-of-friends, friends, only-me} \r\n")
file-print (word "@attribute language-visibility {public, friends-of-friends, friends, only-me} \r\n")
file-print (word "@attribute relationship-status-visibility {public, friends-of-friends, friends, only-me} \r\n")
file-print " \r\n"
file-print "@data \r\n"
ask users with [settings-configured?] [
file-print (word age "," gender "," university "," country "," current-city "," my-interest "," my-language "," my-relationship-status ","
age-visibility "," gender-visibility "," university-visibility "," country-visibility "," current-city-visibility "," interests-visibility "," language-visibility "," relationship-status-visibility "\r\n" )
]
file-close
]
;;;;---------------------------------------------the arff file------------------------------------------------;;;
;;;;---------------------------------------------the csv file-------------------------------------------------;;;
if(output-file-type = "csv" or output-file-type = "all") [
file-open( (word dataset-file-name ".csv" ))
file-print (word "age,gender,university,country,current-city,my-interest"
",my-language,my-relationship-status,age-visibility,gender-visibility,university-visibility,"
"country-visibility,current-city-visibility,interests-visibility,language-visibility,relationship-status-visibility" "\r\n" )
ask users with [settings-configured?] [
file-print (word age "," gender "," university "," country "," current-city "," my-interest "," my-language "," my-relationship-status ","
age-visibility "," gender-visibility "," university-visibility "," country-visibility "," current-city-visibility "," interests-visibility "," language-visibility "," relationship-status-visibility "\r\n" )
]
file-close
]
;;;;---------------------------------------------the csv file end---------------------------------------------;;;
;;;;---------------------------------------------the csv-IRT--------------------------------------------------;;;
if(output-file-type = "csv-IRT" or output-file-type = "all") [
file-open( (word dataset-file-name "[IRT].csv" ))
file-print (word "userID,age,gender,university,"
"country,city,interests,language,relationship" "\r\n" )
ask users with [settings-configured?] [
file-print (word who "," convert-setting age-visibility "," convert-setting gender-visibility "," convert-setting university-visibility "," convert-setting country-visibility ","
convert-setting current-city-visibility "," convert-setting interests-visibility "," convert-setting language-visibility "," convert-setting relationship-status-visibility "\r\n" )
]
file-close
]
;;;;---------------------------------------------the csv-IRT---------------------------------------------------;;;
;;;;---------------------------------------------taking a screenshot-------------------------------------------;;;
Export-Interface (word dataset-file-name ".png" )
;;;;---------------------------------------------end-----------------------------------------------------------;;;
user-message (word "File Exported Successfully!")
end
@#$#@#$#@
GRAPHICS-WINDOW
352
43
1115
827
79
79
4.74
1
10
1
1
1
0
1
1
1
-79
79
-79
79
0
0
1
Iterations
30.0
BUTTON
25
83
88
116
NIL
setup
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
SLIDER
24
45
339
78
num-users
num-users
100
2000
100
1
1
user(s)
HORIZONTAL
BUTTON
97
83
213
116
create graph
form-graph
T
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
26
310
146
343
configure settings
simulate-privacy-settings
T
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
PLOT
25
454
339
574
Gender Distripution
Gender
Perc. (%)
0.0
0.0
0.0
100.0
true
true
"" ""
PENS
"male" 1.0 1 -10899396 true "" "plot-pen-reset\nif count users != 0 [plotxy 0 ( (count users with [gender = \"male\"]) / (count users) ) * 100]"
"female" 1.0 1 -13345367 true "" "plot-pen-reset\nif count users != 0 [plotxy 1 ( (count users with [gender = \"female\"]) / (count users) ) * 100]"
MONITOR
1360
262
1443
307
avg. degree
average-degree
17
1
11
MONITOR
1360
318
1443
363
max. degree
max-degree
17
1
11
MONITOR
1359
374
1443
419
min. degree
min-degree
17
1
11
PLOT
1126
262
1355
419
Number of Friendships
Time Intervals
No. Friendships
0.0
0.0
0.0
0.0
true
false
"" ""
PENS
"default" 1.0 0 -2674135 true "" "plot no-of-friendships"
PLOT
25
579
339
699
Universities Distribution
Universities
Perc. (%)
0.0
4.0
0.0
100.0
true
true
"" ""
PENS
"UCT" 1.0 1 -16777216 true "" "plot-pen-reset\nif count users != 0 [plotxy 0 ( (count users with [university = \"UCT\"]) / (count users) ) * 100]"
"UP" 1.0 1 -7500403 true "" "plot-pen-reset\nif count users != 0 [plotxy 1 ( (count users with [university = \"UP\"]) / (count users) ) * 100]"
"UWC" 1.0 1 -2674135 true "" "plot-pen-reset\nif count users != 0 [plotxy 2 ( (count users with [university = \"UWC\"]) / (count users) ) * 100]"
"Wits" 1.0 1 -955883 true "" "plot-pen-reset\nif count users != 0 [plotxy 3 ( (count users with [university = \"Wits\"]) / (count users) ) * 100]"
"Rhodes" 1.0 1 -6459832 true "" "plot-pen-reset\nif count users != 0 [plotxy 4 ( (count users with [university = \"Rhodes\"]) / (count users) ) * 100]"
PLOT
1124
42
1437
220
Countries Distribution
Countries
Percentage (%)
0.0
8.0
0.0
100.0
true
true
"" ""
PENS
"south africa" 1.0 1 -16777216 true "" "plot-pen-reset\nif count users != 0 [plotxy 0 ( (count users with [country = \"south africa\"]) / (count users) ) * 100]"
"sudan" 1.0 1 -7500403 true "" "plot-pen-reset\nif count users != 0 [plotxy 1 ( (count users with [country = \"sudan\"]) / (count users) ) * 100]"
"nigeria" 1.0 1 -2674135 true "" "plot-pen-reset\nif count users != 0 [plotxy 2 ( (count users with [country = \"nigeria\"]) / (count users) ) * 100]"
"france" 1.0 1 -955883 true "" "plot-pen-reset\nif count users != 0 [plotxy 3 ( (count users with [country = \"france\"]) / (count users) ) * 100]"
"canada" 1.0 1 -6459832 true "" "plot-pen-reset\nif count users != 0 [plotxy 4 ( (count users with [country = \"canada\"]) / (count users) ) * 100]"
"Swaziland" 1.0 1 -1184463 true "" "plot-pen-reset\nif count users != 0 [plotxy 5 ( (count users with [country = \"Swaziland\"]) / (count users) ) * 100]"
"kenya" 1.0 1 -10899396 true "" "plot-pen-reset\nif count users != 0 [plotxy 6 ( (count users with [country = \"kenya\"]) / (count users) ) * 100]"
"cuba" 1.0 1 -13840069 true "" "plot-pen-reset\nif count users != 0 [plotxy 7 ( (count users with [country = \"cuba\"]) / (count users) ) * 100]"
"ghana" 1.0 1 -14835848 true "" "plot-pen-reset\nif count users != 0 [plotxy 8 ( (count users with [country = \"ghana\"]) / (count users) ) * 100]"
TEXTBOX
54
10
306
35
--- Simulation Options ---
20
0.0
1
TEXTBOX
68
426
266
451
--- Demographics ---
20
0.0
1
PLOT
25
706
340
826
Age Distribution
Age
No. Users
0.0
0.0
0.0
0.0
true
false
"set-plot-x-range 0 max-pxcor\nset-plot-y-range 0 num-users\n;set-histogram-num-bars 5" ""
PENS
"default" 3.0 1 -2674135 true "" "histogram [age] of users"
TEXTBOX
606
10
840
35
--- The Social Network ---
20
0.0
1
TEXTBOX
1172
230
1380
261
--- Graph Statistics ---
20
0.0
1
BUTTON
223
83
339
116
graph one step
form-graph
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
154
310
338
343
configure settings one step
simulate-privacy-settings
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
148
349
230
394
export data
ifelse (any? links or is-random-data) [\nexport-gexf\n]\n[\nuser-message (\"Sorry, No Data to be Exported!\")\n]
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
PLOT
1127
425
1444
563
Degree Distribution
Degrees
No. Users
0.0
0.0
0.0
10.0
true
false
"set-plot-x-range 0 100\nset-plot-y-range 0 num-users" "if any? links [\nset-plot-x-range 0 max [count link-neighbors] of users\nset-plot-y-range 0 (count users with [count link-neighbors = min [count link-neighbors] of users]) + 1\n]"
PENS
"default" 1.0 2 -2674135 false "" "histogram [(count link-neighbors)] of users"
"pen-1" 1.0 0 -3026479 true "" "histogram [(count link-neighbors)] of users"
SLIDER
26
119
183
152
alpha
alpha
0
1
0.5
.1
1
NIL
HORIZONTAL
SLIDER
189
119
339
152
beta
beta
0
1 - alpha
0.5
.1
1
NIL
HORIZONTAL
SLIDER
27
156
60
306
age-weight
age-weight
0
1
0.3
.01
1
NIL
VERTICAL
SLIDER
66
156
99
306
gender-weight
gender-weight
0
1
0.15
.01
1
NIL
VERTICAL
SLIDER
105
156
138
306
university-weight
university-weight
0
1
0.75
.01
1
NIL
VERTICAL
SLIDER
144
155
177
307
country-weight
country-weight
0
1
0.27
.01
1
NIL
VERTICAL
SLIDER
184
156
217
306
current-city-weight
current-city-weight
0
1
0.89
.01
1
NIL
VERTICAL
SLIDER
223
156
256
306
interest-weight
interest-weight
0
1
0.51
.01
1
NIL
VERTICAL
SLIDER
263
156
296
306
language-weight
language-weight
0
1
0.22
.01
1
NIL
VERTICAL
SLIDER
303
157
336
306
relationship-weight
relationship-weight
0
1
0.83
.01
1
NIL
VERTICAL
PLOT
1128
571
1442
719
No. Users who Configured Their Settings
Time Intervals
No. Users
0.0
10.0
0.0
10.0
true
false
"set-plot-y-range 0 num-users" ""
PENS
"# Configured" 1.0 0 -2674135 true "" "plot count users with [ settings-configured? ]"
CHOOSER
27
349
142
394
output-file-type
output-file-type
"all" "weka-arff" "csv" "csv-IRT" "general"
0
BUTTON
235
349
338
394
random-settings
random-settings
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
@#$#@#$#@
## WHAT IS IT?
A model that simulates the friendship formation and the propagation of privacy settings configuration in online social networks
## HOW IT WORKS
For generating the social graph of the social network, agents simply rely on homophily (i.e. tendency of individuals to associate and bond with similar others) and the number of mutual friends, to create their friendships, and to simulate the propagation of privacy settings configuration, agents rely on their internal privacy concern level and the privacy weight of each attribute to configure their privacy settings in a ways that suits each agent personally.
## HOW TO USE IT
Despite how it looks the model is simple, the simulation is done in two steps: creating the graph, and configuring privacy settings (in the same order).
**[a]** To simulate the social graph creation:
1. Choose the number of user (optional)
2. Press the setup button to create the users
3. Press create graph to start the simulation
**[b]** To simulate privacy settings configuration:
1. Select suitable values for the parameters
2. Press configure settings
## THINGS TO TRY
Manipulate the different model parameters to get different results
## CREDITS AND REFERENCES
[Ammar M. Abuelgasim](https://people.cs.uct.ac.za/~aabuelgasim/)
Masters student
University of Cape Town
@#$#@#$#@
default
true
0
Polygon -7500403 true true 150 5 40 250 150 205 260 250
airplane
true
0
Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15
arrow
true
0
Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150
box
false
0
Polygon -7500403 true true 150 285 285 225 285 75 150 135
Polygon -7500403 true true 150 135 15 75 150 15 285 75
Polygon -7500403 true true 15 75 15 225 150 285 150 135
Line -16777216 false 150 285 150 135
Line -16777216 false 150 135 15 75
Line -16777216 false 150 135 285 75
bug
true
0
Circle -7500403 true true 96 182 108
Circle -7500403 true true 110 127 80
Circle -7500403 true true 110 75 80
Line -7500403 true 150 100 80 30
Line -7500403 true 150 100 220 30
butterfly
true
0
Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240
Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240