Suppose that the more common friends two nodes have, the more closely they are related. I want to find the closest link-neighbor
of a node.
But it's difficult for me to find the common friends between one random nodes and its link-neighbors.
I wrote an example to see if my thought works:
turtles-own[CF] ;;common friends
to setup
ca
crt 10 [set size 1 set color gray]
ask turtle 1 [create-links-with other turtles]
ask turtle 2 [create-link-with turtle 3]
ask turtle 2 [create-link-with turtle 4]
layout-circle (sort turtles) 5
reset-ticks
end
to go
ask one-of turtles [
let communicator self
ask link-neighbors [;;setA
let i 0
ask link-neighbors [;;setB
if link-neighbor? communicator[
set i i + 1
]
]
set CF i
]
]
tick
end
In the interface, I set a reporter [CF] of turtle 2
.If it works, the answer could be 2
But as it keeps going, the reporter shows sometimes 1 and sometimes 2. I don't know why and I hope sth more simple.