Dear Charles,

> number of vertices of a network from in simple pajek file. The program
> compiles correctly, it reads the edges of the network correctly, but
> it reads the number of vertices like a strange number, like -10585152.
I'm 99% sure that this is a printing/formatting issue, i.e. the number in the 
variable is fine but you print it with the wrong format string. The reason why 
it happens on a 64-bit machine only is because the variable type that printf 
expects for that particular format string that you are using happens to be of 
the same length as your actual variable on a 32-bit machine but not on a 64-bit 
machine.

For the record, igraph_vcount returns the vertex count in an igraph_integer_t. 
_Internally_, igraph_integer_t used to be a double before igraph 0.6, but that 
confused the hell out of people (including me) so we switched to 
igraph_integer_t being a long int. That being said, the safest way to print an 
igraph_integer_t is by casting it explicitly to a long int to make sure that 
the code works with every igraph version:

igraph_integer_t whatever;
[...]
printf("whatever = %ld\n", (long int)whatever);

Best,
Tamas


_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to