How do I code a Hierarchical Network according to this paper using Netlogo?

I’m trying to code a hierarchical network using NetLogo following the paper “Hierarchical organization in complex networks” (2003) by Erzsebet Ravasz and Albert-Laszlo Barabasi. I first would like to build the model in Section II (Hierarchical Network Model) and then Section III (Hierarchical Organization in Real Networks) but struggling to find a way to implement it due to lack of Object Oriented Programming in NetLogo.

text

So far, here’s my code for Section II (Hierarchical Network Model):

globals[dist help generation-count]

turtles-own[
  center-node?
  generation
  model?
]

to setup
  ca
  set dist 1.2
   crt num[
    create-links-with other turtles
    set shape "dot"
    set size 1.5
  ]
  let c 0
  repeat (num - 1)[
    ask one-of turtles with[xcor = 0 and ycor = 0][
      set heading 360 / (num - 1) * c fd dist
    ]
    set c c + 1
  ]
  ask turtles[
    ifelse(xcor = 0 and ycor = 0)[set center-node? true][set center-node? false]
    set color red
    set generation 1
    set model? true
  ]
  set generation-count 1
 ; repeat x[recreate]
end

to recreate
  set generation-count generation-count + 1
  let c 0
  set help count turtles
  loop [
    ask turtles with[model? = true][
      hatch 1 [
        set generation generation-count
        repeat generation - 1[
          set heading 0
          set heading (heading + 360 / (num - 1) * c)
          fd generation * dist
        ]
        set model? false
      ]
    ]
    finish-member(turtles with[count link-neighbors = 0])
    set c c + 1
    ask turtles with[center-node? = false and generation = generation-count][create-links-with other turtles with[center-node? = true and generation = 1]]
    ;layout
    if(count turtles = help * num)[stop]
  ]
end

to finish-member[people]
  ask people[create-links-with other people]
end

to layout
  ;; the number 3 here is arbitrary; more repetitions slows down the
  ;; model, but too few gives poor layouts
  repeat 100 [
    ;; Refactoring the link lengths (MODIFY DENSITY HERE?)
    ;; the more turtles we have to fit into the same amount of space,
    ;; the smaller the inputs to layout-spring we'll need to use
    let factor ((sqrt count turtles) / 3) ;; Here SF-density-mod influences the distance factor across the network - will impact search function...
                                          ;; numbers here are arbitrarily chosen for pleasing appearance
    layout-spring turtles links (1 / factor) (7 / factor) (1 / factor)
    display  ;; for smooth animation
  ]
  ;;; Centering network ;;;
  ;; don't bump the edges of the world
  let x-offset max [xcor] of turtles + min [xcor] of turtles
  let y-offset max [ycor] of turtles + min [ycor] of turtles
  ;; big jumps look funny, so only adjust a little each time
  set x-offset limit-magnitude x-offset 0.1
  set y-offset limit-magnitude y-offset 0.1
  ask turtles [ setxy (xcor - x-offset / 2) (ycor - y-offset / 2) ]
end

to-report limit-magnitude [number limit]
  if number > limit [ report limit ]
  if number < (- limit) [ report (- limit) ]
  report number
end

I was unable to position them like in the paper so I resorted to the NetLogo “layout” procedure but then I realized the way they were being linked is also incorrect; the peripheral outer nodes are not correctly linking to the peripheral central nodes.

Expected
My Model

The attached picture is for when n=2, which is just incorrect.
I want to be able to somehow use recursion so I can also use it for Section III (Hierarchical Organization in Real Networks) as well.
Please help me find a solution to this.

New contributor

kenjanaki is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật