Average calculation from vector<double> property
Hi, I am using graph-tool for my research, thanks for creating graph-tool. I need to calculate average values from vertex and edge properties. Property types are "vector<double>". When I use the "edge_average" function, program gives 'RuntimeError'. How can I calculate averages from vector property? Example code below: g = Graph() v1 = g.add_vertex() v2 = g.add_vertex() v3 = g.add_vertex() e1 = g.add_edge(v1, v2) e2= g.add_edge(v2, v3) e3= g.add_edge(v1, v3) e_properties = g.new_edge_property("vector<double>") e_properties[e1] = [0.0005] e_properties[e2] = [0.006,0.0007] edge_average(g, e_properties) Thanks! -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
On 27.04.2015 00:31, desert_rain wrote:
Hi,
I am using graph-tool for my research, thanks for creating graph-tool.
I need to calculate average values from vertex and edge properties. Property types are "vector<double>". When I use the "edge_average" function, program gives 'RuntimeError'. How can I calculate averages from vector property?
Right now you can't, because the sum of two vectors is not defined. You have to split the vector into two property maps with ungroup_vector_property() and calculate the averages separately. Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
On 27.04.2015 16:29, Tiago de Paula Peixoto wrote:
On 27.04.2015 00:31, desert_rain wrote:
Hi,
I am using graph-tool for my research, thanks for creating graph-tool.
I need to calculate average values from vertex and edge properties. Property types are "vector<double>". When I use the "edge_average" function, program gives 'RuntimeError'. How can I calculate averages from vector property?
Right now you can't, because the sum of two vectors is not defined.
I have fixed this now in git. The average of vector-valued property maps now works as expected. Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
Thank you alot for this quick fix. You are awesome! -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
participants (2)
-
desert_rain -
Tiago de Paula Peixoto