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.

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.



--
View this message in context: 
http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/Using-a-EdgePropertyMap-object-as-weights-tp4025744.html
Sent from the Main discussion list for the graph-tool project mailing list 
archive at Nabble.com.
_______________________________________________
graph-tool mailing list
[email protected]
http://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to