[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] degree distribution
From: |
Tam??s Nepusz |
Subject: |
Re: [igraph] degree distribution |
Date: |
Thu, 13 Jun 2013 07:40:02 +0200 |
Hi,
There was a bug in the Histogram class that has been fixed recently; basically,
the __len__ method returned a float value incorrectly instead of an integer.
The fix involves simply replacing one line in igraph/statistics.py:
https://github.com/igraph/igraph/commit/73b5234
This should solve your problem. Alternatively, you can stop using the
degree_distribution() method and do this instead:
from collections import Counter
dd = Counter()
for d in g.degrees():
dd[d] += 1
Then you can simply use the methods of the standard Python Counter class to
query the values in the degree distribution.
--
T.
On 13 Jun 2013, at 01:27, "????????????" <address@hidden> wrote:
> Hi folks,
>
> I'm using igraph in python.
>
> the function degree_distribution returns a instance of Histogram.
>
> How can I see the individual values in it, please?
>
> It always says "TypeError: 'float' object cannot be interpreted as an
> integer" when I call some functions such as to_string(). I think it is
> because the values of degree distribution is probabilities in float.
>
> Thanks a lot.
>
> Gang
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help