igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] How to avoid indexing issues with "which" fuction


From: giorgio delzeri
Subject: Re: [igraph] How to avoid indexing issues with "which" fuction
Date: Sat, 17 Jun 2017 13:03:02 +0200

Hy, I am here again to ask for help.
1) In fact it was just like that, I can not select a node to become "SPREADER" within the "IGNORANT" neighbours of the current "SPREADERS"  without considering the number SPREADER nodes in the neighborhood.
But what happens if I simply remove the funcion "unique"? Will it work? Or maybe can I Remove the "unique" function, then sampling the vector (in wich some nodes may appear 2,3... or more times) and, then, apply "unique" fuction to the vector obtained by the "sample"? What do you think? Any suggestions?
2) In the while cycle, till now, I selected the nodes to become "STIFLER" (such as nodes that recover from a disease, but this is not a disease, is innovation spreading) within the whole "SPREADER" nodes, included that nodes that become "SPREADER" in that same iteration. Now I have to change this and select the nodes to become "SPREADER" only within the nodes that were already "SPREADER", I mean before the single iteration. Otherwise, it can happens that a node become "SPREADER" and, in the same iteration, it become "STIFLER", and if there are not others "SPREADER", the algorithm stops.
Any suggestion?
Thanks in advance.
Giorgio
 

2017-06-13 21:52 GMT+02:00 giorgio delzeri <address@hidden>:
Hi Tamas, I solved my problem!
There is an issue with the "sample" fuction.
In fact, if the vector to be sampled have a certain dimension, from 2 onwards, no problem.
Otherwise, If the vector has dimension 1, so there is only one element in it (for example a vertex of the graph, and that vertex is called "8") the sample function behave differently: It will create itself a vector (referred to the previous example, it will create a vector of 8 elements, from 1 to 8) and it will sample that new vector.
I solved with an "if": if the vector has lenght>1, ok; If the vector has lenght =1, choose the single element in the vector.
thank you!

2017-06-08 11:02 GMT+02:00 Tamas Nepusz <address@hidden>:
By the way, I probably exposed the algorithm in a wrong way (I don't speak english very well).
A given percentage of the whole vertices, are selected at the beginning of the algorithm to be "IMMUNE", and they will be immune all the time, so I expect to have the same percentage of nodes to be immune at the end of the algorithm, but some of these nodes passed from "immune" to "spreader" during the process.
I understand that, but the best that you can do at this stage is to print the state of each vertex and the set of relevant variables after each iteration of the loop, and then stop immediately when you find that one of your vertices went into the wrong state. Then you can look at the variables right before the incorrect state change and figure out what goes wrong where. This is what I would do anyway if I were you.

T.

_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help




reply via email to

[Prev in Thread] Current Thread [Next in Thread]