[pgrouting-dev] selection of node types in dijkstra/TSP etc

Stephen Woodbridge woodbri at swoodbridge.com
Tue Apr 10 09:49:34 EDT 2012


On 4/10/2012 7:22 AM, Dave Potts wrote:
>
>
> Hi
>
> Normally routing problems such as dijkstra/TSP always select the best
> route by the length of the route.
>
> Does anybody known a version that selects the route choosen by the node
> type as well as the distance covered?  The reason that I ask, in cases the
> select of the node type is important for example
>
> I am trying to get from node A to F,
>
> I have to possible routes A B C F  , A E to F or A D F.
>
> The route  A D E is the shortest one, but D is noted number of highway
> men/gunfighters living in town.
>
> I am a careful man and would prefer to travel the safest fast route.  Is
> there a generic solution to this type of problem other than removing D
> from the input list of nodes to compare?
>
> Can anybody suggest a different news group where this type of issue could
> be raised?

In pgRouting it is trivial to do this by putting a filter on the edges 
to remove edges or nodes of a particular class(es). Something like:

select * from edges where etype != 'dangerous';

select * from edges a, nodes b where a.source=b.id or a.target=b.id and 
b.ntype not in ('dangerous', 'dirty');

-Steve


More information about the pgrouting-dev mailing list