TransWikia.com

Why pgr_dijkstra function is faster with directed graph?

Geographic Information Systems Asked by Edwards on May 13, 2021

I’m doing thousands of tests to get the average route time calculated with the pgr_dijkstra function, taking random nodes.

In all tests the average time to generate the routes of the directed graphs (vehicles) is about 100 milliseconds faster than for undirected graphs (pedestrians). It seems like a very short time, but generating thousands of routes the total time less turns into minutes.

Why is that? Is it because in the directed graphs the reverse_cost is ignored, and that is why the function does not spend its time analyzing this field? And in the undirected graphs is the cost and reverve_cost field analyzed?

Function example with undirected graph:

SELECT * FROM pgr_dijkstra(
'SELECT gid AS id,
     source,
     target,
     length AS cost
    FROM ways',
9411, 3986,
directed := false);

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP