igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Invalid (negative) vertex id, Invalid vertex id


From: Christian Gonzalez
Subject: Re: [igraph] Invalid (negative) vertex id, Invalid vertex id
Date: Fri, 07 Aug 2009 16:27:13 -0430
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Lightning/1.0pre Thunderbird/3.0b2

Hi Tamas,
Thanks a lot for your suggestions, my problem was in the fetch_edges loop.

Regards,
Christian

El 06/08/09 17:16, Tamas Nepusz escribió:
Hi Christian,

But if you only want to see the code, is it:
I guess somehow you manage to add negative numbers to the "edges" vector in fetch_edges. I mean this part of the code:

static int fetch_edge(HeapTuple *tuple, TupleDesc *tupdesc, long int i, pgr_edge_columns_t *edge_columns, igraph_vector_t *edges, igraph_vector_t *weights, igraph_vector_t *eids,
          igraph_vector_t *vertex, bool directed)
{ [...] VECTOR(*eids)[i] = DatumGetInt32(id_binval);
 VECTOR(*edges)[(2*i)] = DatumGetInt32(s_binval);
 VECTOR(*edges)[(2*i) + 1] = DatumGetInt32(t_binval);
 VECTOR(*weights)[i] = DatumGetFloat8(c_binval);
I have a feeling that either DatumGetInt32(s_binval) or DatumGetInt32(t_binval) returns -1 for some reason and that's why you are having the error. Please check explicitly whether you have negative values in the "edges" vector before calling igraph_create -- you can use igraph_vector_min() to check that easily.








reply via email to

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