This reporter procedure serves to make turtles calculate the ‘hub integration’ of their link-neighbors
Hub integration (HI) can also be written as HI = number-of-shared-neighbors/n-of-your-neighbors.
The code snippet was suggested to me on Stack Overflow.
to find-hi ask turtles [ foreach sort link-neighbors [ ask ? [ if count [my-links] of self > 1 and count [my-links] of myself > 1 [ let hi ( calc-HI self myself ) run-procedure ] ] ] ] end to-report calc-HI [ XX YY ] let sizeX count [my-links] of XX let sizeY count [my-links] of YY let sizeXY count (turtle-set [link-neighbors] of XX [link-neighbors] of YY) report (sizeX + sizeY - sizeXY) / sizeY end