[pgrouting-users] weighted costs

Stephen Woodbridge woodbri at swoodbridge.com
Fri Mar 16 09:16:44 EDT 2012

On 3/16/2012 8:12 AM, Pedro Costa wrote:
> Hello list,
> Does anybody know tutorial or more detailed information about the use of
> weighted costs?
> I only know that:
> http://workshop.pgrouting.org/chapters/advanced.html

Cost is just a positive value (negative edge cost are not allow). You 
can use distance as a cost, or time as a cost, or turn angle as a cost, 
or anything you want that makes sense for what you are modelling. The 
issues is what are you modelling and and what do you want to take into 
account and can you model that factor as a cost or a component of the cost.

For example, you could convert all costs into some increase number of 
seconds to traverse from node A to node B. then you could model the 
distance and average speed as time. If you had an attribute at a node 
the indicated a traffic light or stop sign, you could add some 
additional average wait time to the edges passing through that node. If 
you had an attribute say the road had lots of potholes, you could assume 
some lower average speed, etc.

You have to transform the things you are modelling into some unit or 
unitless value as a cost.

-Steve W

More information about the Pgrouting-users mailing list