[pgrouting-users] rebuild topology

Stephen Woodbridge woodbri at swoodbridge.com
Mon Jul 20 09:58:21 EDT 2009

Laura Criscuolo wrote:
>   Hi everybody,
> I'm involved in a research on network routing in emergency situations, 
> and I need to menage a huge network database, to wich I'm going to add 
> and remove roads periodically.
> To rebuild the topology (with the assign_vertex_id function) whenever 
> I modify the network takes really plenty of time; do you know a quicker 
> way to insert in the topology the new data?
> Thanks in advance!
> Laura 

Hi Laura,

assign_vertex_id() function basically iterates through all the edges in 
your graph and assigns node number to the source and target columns. So 
you could write a function the assigns the source and target node 
numbers to a single edge and call that on each new edge you add to the 

Since the source and target numbers are stored on the edges removing the 
an edge record will remove it from the graph.

Look at the assign_vertex_id() and it should be pretty straight forward 
and obvious as to how to make a new function. Post your questions and 
results here and we would be happy to review and/or comment on it.

Best regards,

More information about the Pgrouting-users mailing list