I am trying to make a network with 20 nodes. Their IDs are from 1 to 20. I have to connect them with preferential attachment (the next added node will prefer attaching to a node which has more connections than the others). I created a random dataset with the number of connections they will make:
[2, 3, 5, 1, 1, 0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0]
In there, it says, node1 will be connected to two nodes. Node2 will be connected to 3 nodes, node3 will be connected to 5 nodes,etc. However, I am not able to make these connections randomly.
node1 can bind to node2 + node 20, and in the next code running, it can also bind to node3+node9. All random.
How can I make these random connections per node with this given set of connection numbers for each node?
Aucun commentaire:
Enregistrer un commentaire