[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] threshold

From: Tamas Nepusz
Subject: Re: [igraph] threshold
Date: Sun, 28 Mar 2010 16:30:14 +0200


> Is there a direct way in iGraph to calculate a threshold that will retain 
> let's say 2% of the strongest weighted edges and convert a weighted graph to 
> a binary graph using this threshold ?
No, since it is only a few lines of code using either the R or the Python 
interface. In Python, you can do something like this:

weights = sorted(g.es["weight"], reverse=True)
threshold = weights[len(weights) * 0.02]
g.delete_edges(g.es.select(weight_lt = threshold))
del g.es["weight"]


reply via email to

[Prev in Thread] Current Thread [Next in Thread]