[pgrouting-dev] Re: Implementation of core Time Dependent Dijkstra
function
Stephen Woodbridge
woodbri at swoodbridge.com
Mon Jun 6 09:31:28 EDT 2011
When I was looking at this code I had the similar thoughts regarding
boost_dijkstra(). In fact in my mind I would replace both directed and
has_reverse_cost with one variable "char *reverse_cost". if this is null
then the graph is undirected. if this has a value then it is the column
name of the reverse cost column and it is directed.
Or alternatively, if the reverse cost column name is always
"reverse_cost" then you only need has_reverse_cost and the fact that
this is set implies a directed graph.
Seems like Anton has come to the same conclusion also. I'm not sure if
there is any value building a directed graph when reverse_cost=cost.
-Steve
On 6/6/2011 2:24 AM, Anton Patrushev wrote:
> Hi Jay,
>
> Those two parameters exist mostly by historical reasons (hysterical raisins :))
> Of course indirected graph can be represented by directed graph where
> reverse costs for all edges are equal to costs. But in this case we
> need one extra non-empty field in edges table which increases the
> amount of stored data (not big deal though).
>
> Now if undirected = true, we add reverse_cost=cost automatically.
>
> In your case I guess that graph is directed without reverse cost.
>
> Anton.
>
> On 6/6/11, Jay Mahadeokar<jai.mahadeokar at gmail.com> wrote:
>> Hi,
>>
>> I am writing a function tdsp_caller() which will call the core tdsp()
>> function, on lines of boost_dijkstra() function in boost_wrapper.cpp.
>>
>> The prototype is like this:
>> int tdsp_wrapper(
>>
>> edge_columns_t *edges,
>> unsigned int edge_count,
>> weight_map_element_t *weight_map_elements,
>> int weight_map_element_count,
>> int start_vertex,
>> int end_vertex,
>> bool directed,
>> bool has_reverse_cost,
>> path_element_t **path,
>> int *path_count,
>> char **err_msg
>>
>> );
>>
>> I am confused about the has_reverse_cost and directed variables in this
>> scenario. I have mainly tested for directed graphs till now. I think for
>> undirected graphs, we can add reverse edge while generating graph to make it
>> directed.
>>
>> Now, since the costs here are the travel_time in the weight_map
>> corresponding to each start_time, do we need a has_reverse_cost variable
>> here? If yes, what would be its significance?
>>
>> Regards,
>>
>> --
>> Regards,
>> -Jay Mahadeokar
>>
>
>
More information about the pgrouting-dev
mailing list