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: Tamas Nepusz
Subject: Re: [igraph] Invalid (negative) vertex id, Invalid vertex id
Date: Thu, 6 Aug 2009 22:46:49 +0100

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.

--
Tamas





reply via email to

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