def convert_percentile_to_thresh(g, percentile):
""" Figure out what value in g corresponds to the given percentile.
Args:
@param g:
@type g: igraph.Graph
@param percentile: between 0 and 100
@type percentile: float
Returns:
thresh
"""
assert percentile < 100 and percentile > 0, (
"percentile must be between 0 and 100. percentile: {}".format(percentile))
thresh = np.nanpercentile(np.abs(g.es["weight"]), percentile)
return thresh
评论列表
文章目录