WikiAnalytics

WikiAnalytics preview image

2 collaborators

I-patarakin Evgeny Patarakin (Author)
Default-person Boris Yarmakhov (Team member)

Tags

analytics 

Tagged by Evgeny Patarakin almost 5 years ago

nw 

"nw_extension"

Tagged by Evgeny Patarakin almost 5 years ago

wiki 

Tagged by Evgeny Patarakin almost 5 years ago

Parent of 1 model: Child of WikiAnalytics
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.1.0 • Viewed 217 times • Downloaded 10 times • Run 0 times
Download the 'WikiAnalytics' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Info tab cannot be displayed because of an encoding error

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

extensions [nw]

breed [users user] ;
breed [pages page] ;
undirected-link-breed  [bonds bond] ;

users-own [agentname] ;
pages-own [pagename] ;
bonds-own [edits] ;

to startup
clear-all ;
    set-default-shape users "person" ;
  set-default-shape pages "box" ;
end 


;; 

to load_data
    ifelse ( file-exists? "user_page_u.txt" )
   [

    file-open "user_page_u.txt"
        while [ not file-at-end? ]     [ visual list file-read file-read ]
    file-close
    user-message "Готово!"
     ]
   
     [ user-message "user_page_u.txt нет такого файла!" ]
end 

to use_list   
let wikihistory [
["Ученик_1" "Страница_1"]
["Ученик_1" "Страница_2"]
["Ученик_1" "Страница_3"]
["Ученик_1" "Страница_2"]
["Ученик_1" "Страница_3"]
["Ученик_2" "Страница_3"]
["Ученик_3" "Страница_3"]
["Ученик_4" "Страница_4"]
["Ученик_5" "Страница_5"]
["Ученик_6" "Страница_6"]
["Ученик_2" "Страница_6"]
["Ученик_2" "Страница_7"]
["Ученик_2" "Страница_1"]
["Ученик_1" "Страница_1"]
["Ученик_1" "Страница_1"]
["Ученик_4" "Страница_4"]
["Ученик_4" "Страница_4"]
["Ученик_7" "Страница_8"]
["Ученик_7" "Страница_9"]
["Ученик_7" "Страница_9"]
["Ученик_7" "Страница_8"]
["Ученик_8" "Страница_9"]
["Ученик_8" "Страница_8"]

  ]
  foreach wikihistory [visual ?] ;  
end 

to generate_list 
let wikihistory generate "User" "Page"  ;
  foreach wikihistory [visual ?] ;
end 

to-report generate [a b]
  let glist [] ;
  repeat g_agents + g_pages [
    set glist lput list word a (1 + random g_agents)  word b (1 + random g_pages ) glist ; 
  ]
report glist
end 

to visual [flist]
 let agent_name first flist ;; это мы просто считали имена агентов и страниц
 let page_name last flist
;; если у нас нет страницы и нет юзера ;
ifelse (not any? users with [agentname = agent_name]) and  (not any? pages with [pagename = page_name])
  [ 
  create-ordered-users 1 [
    set size 1.4
    set color red 
    set agentname agent_name ;
 ;   set label agentname ;
    hatch-pages 1 [ set pagename page_name set color green   create-bond-with myself ;
      ask bond  [who] of myself [who] of self [set edits 1  ]
      ] ;        
                         ]
  ]
;; Не было юзера, а страница уже была - т.е. появляется автор и его действие - редактирование существующего
[ ifelse (not any? users with [agentname = agent_name]) and  (any? pages with [pagename = page_name])
  [
  let myfirstpage [who] of one-of pages with [pagename = page_name] ;
   ask page  myfirstpage [hatch-users 1 
     [ set color red set agentname agent_name   
       ; set label agentname 
       create-bond-with myself   ;
       ask bond [who] of self myfirstpage [set edits 1 ] 
     ]
      ]
    ]
;; у нас есть юзер, но нет страницы
[ ifelse (any? users with [agentname = agent_name]) and  (not any? pages with [pagename = page_name])
  [
  let author [who] of one-of users with [agentname = agent_name] ;
   ask user author [hatch-pages 1 
     [ set color green  set pagename page_name  
        ; set label pagename  
        create-bond-with myself      
       ask bond author [who] of self  [set edits 1] 
        ] 
       ;     
      ]
    ]
;; Ситуация, когда есть и пользователь и страница - и там варианты с тем, что есть связь или нет связи
[
    let author [who] of one-of users with [agentname = agent_name] ;
      let mypage [who] of one-of pages with [pagename = page_name] ;
      ifelse is-link? bond author mypage [ask bond author mypage [set edits edits + 1 ] ]
     [ask user author [create-bond-with page mypage] ask bond author mypage [set edits 1]  ]
  ]
]] 

layout
end 

to analytics
nw:set-context turtles bonds
; show map sort nw:get-context
;; ask  turtles [set label round nw:betweenness-centrality ]
 ask  turtles [set label nw:eigenvector-centrality ] ;; - только для связанной сети
;; ask  turtles [set label nw:closeness-centrality ] 
;; ask  turtles [set label nw:clustering-coefficient ] 
ask  turtles [set label nw:bicomponent-clusters ] 
;;show global-clustering-coefficient
;; show nw:weak-component-clusters
;;show nw:maximal-cliques ;; - не работает
;; show nw:biggest-maximal-cliques
end 

to layout
 repeat 3 [
 ;;   layout-spring turtles links 0.18 0.01 1.2
    layout-spring turtles links 0.2 0.01 1.4  
    display
  ]
end 

to show_names
  ask users [ set label agentname]
  ask pages  [set label pagename]
  ask bonds [set label edits]
  ask turtles [set label-color orange]
end 

to-report global-clustering-coefficient
  let closed-triplets sum [ nw:clustering-coefficient * count my-links * (count my-links - 1) ] of turtles
  let triplets sum [ count my-links * (count my-links - 1) ] of turtles
  report closed-triplets / triplets
end 

There are 2 versions of this model.

Uploaded by When Description Download
Evgeny Patarakin almost 5 years ago NW-extension was added, so it is possible to investigate centralities and clusters Download this version
Evgeny Patarakin about 5 years ago Initial upload Download this version

Attached files

File Type Description Last updated
WikiAnalytics.png preview Preview for 'WikiAnalytics' about 5 years ago, by Evgeny Patarakin Download

This model does not have any ancestors.

Children:

Graph of models related to 'WikiAnalytics'