Large Node ID

Hi,

I have a huge graph saved in a text file as an edge list. i.e.,
"node_id_v, node_id_w". As the node IDs are very large I have to use
"long()" to convert "node_id_v" to a number. Therefore, I run in trouble
when passing those longs to "add_edge()".

Is there a workaround?

Best,
Chris

Hi Christopher,
the default behavior of add_edge is to create the missing vertices. If you
specify a number instead of a vertex object, i.e. 10, all the missing
vertices up to id 10 will be created.
So, either you create all the vertices up to the maximum long N in your
file, using add_vertex(N) as initialization (I used this solution for a
recent project with millions of vertices), or you should map your longs to
a normalized interval (in case you have sparse ids) and then use a
PropertyMap to store their original value.

Best,
Giuseppe

attachment.html (1.63 KB)