Hi
From what I understand of Dijkstras search, Dijkstras visitor is invoked at traversal of a vertex. However, this is still separate from the weights which is a required argument the algorithm takes. In my case however, the weight of traversing the edge is a function of cost of traversing to the edge from the origin vertex.
I just used cost * weight as an example. In the actual algorithm, weight(edge) = interval_search(cost(edge[origin_vertex] ), interval_map)
On 18.09.2014 11:42, ambasta wrote:Take a look at the search module:
> Hi,
>
> I have two problems
>
> class Weights:
> ...
>
>
> g = Graph(directed=True)
> weights = g.new_edge_property('object')
>
> vertex_one = g.add_vertex()
> vertex_two = g.add_vertex()
> edge = g.add_edge(vertex_one, vertex_two)
> weights[edge] = Weights(1)
>
> g.shortest_path(vertex_one, vertex_two, weights)
>
> This raises ValueError: property map 'dist_map' is not of scalar type. Is
> there a function I can implement in Weights for it to return a scalar value
> to be used during calculation of shortest path.
https://graph-tool.skewed.de/static/doc/search_module.html
You should use the dijkstra_search() function, and specialize the
DijkstraVisitor class to do what you want.above. However, note that multiplying weights is the same as summingYou can do that with the dijkstra_search() function, as I mentioned
> Secondly, consider a directed graph where the edge weight is a function of
> cost at edge's origin vertex, i.e. the weight class is defined as:
>
> class Weights:
> ....
> def get_weight(current_cost):
> return self.cost * current_cost
>
>
> Hence during calculation of shortest_path/distance, is it possible to pass
> the weight at the traversed/visited edge to get the cost of the edge.
their logarithms... Hence you could simply use the log of the weights
instead, and save you some trouble.
Best,
Tiago
--
Tiago de Paula Peixoto <[hidden email]>
_______________________________________________
graph-tool mailing list
[hidden email]
http://lists.skewed.de/mailman/listinfo/graph-tool
signature.asc (836 bytes) Download Attachment--
Tiago de Paula Peixoto <[hidden email]>
If you reply to this email, your message will be added to the discussion below:http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/Using-a-EdgePropertyMap-object-as-weights-tp4025744p4025745.html