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: Tue, 13 Jun 2017 21:52:37 +0200

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]