Commit 07dbd3b0 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Always convert histogram counts to float64

This is to avoid a common error of not being able to correctly normalize
a histogram because of truncated integer division.
parent e5a0b5e4
......@@ -44,12 +44,12 @@ __all__ = ["vertex_hist", "edge_hist", "label_components",
def vertex_hist(g, deg, bins=[1]):
ret = libgraph_tool_stats.\
get_vertex_histogram(g.underlying_graph(), _degree(deg), bins)
return [ret[0], ret[1]]
return [array(ret[0]), ret[1]]
def edge_hist(g, eprop, bins=[1]):
ret = libgraph_tool_stats.\
get_edge_histogram(g.underlying_graph(), eprop, bins)
return [ret[0], ret[1]]
return [array(ret[0]), ret[1]]
def label_components(g, vprop):
if vprop not in g.vertex_properties:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment