[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] why use floating point for graph nodes?
From: |
Gábor Csárdi |
Subject: |
Re: [igraph] why use floating point for graph nodes? |
Date: |
Thu, 5 Nov 2015 09:17:53 +0000 |
I haven't measured anything. It uses half the memory, which is already
a good thing.
Btw. the reason for the double is that in the old times this was a
standardized type, and long wasn't, and I didn't know how to use a
portable integer type that is big enough and compatible with R's
integer type, so that you don't need to copy between C and R.
Gabor
On Thu, Nov 5, 2015 at 9:12 AM, Szabolcs Horvát <address@hidden> wrote:
> Hi Gabor,
>
> Just out of curiosity, have you measured what sort of performance
> impact that change had, if any?
>
> Szabolcs
>
> On 5 November 2015 at 10:08, Gábor Csárdi <address@hidden> wrote:
>> FYI: https://github.com/igraph/igraph/tree/feature-int-igraph_t
>>
>> Gabor
>>
>> On Wed, Nov 4, 2015 at 11:12 PM, Tamas Nepusz <address@hidden> wrote:
>>> Ah, sorry, just realized that igraph_t contains igraph_vector_t
>>> objects, and those indeed contains doubles. Yes, you are right, this
>>> is weird, and this is a heritage from the old days when
>>> igraph_integer_t was also typedef'd to a double. Just for fun I have
>>> changed the types in igraph_t to igraph_vector_long_t and made a few
>>> quick modifications to src/type_indexededgelist.c to make things
>>> compile without warnings, and it seems to do the trick - all tests
>>> compile just fine. However, there are probably lots of unnecessary
>>> casts left in the code, and of course we cannot change the public API
>>> (which still uses igraph_vector_t in lots of cases to store vertex
>>> lists) without breaking everyone else's code, so this quirk is
>>> probably here to stay for while (unless Gabor makes an executive
>>> decision and decides to break the API intentionally).
>>>
>>> If anyone is interested in it, I have pushed the changes into a
>>> separate branch named feature/graph_t-with-long-vector.
>>>
>>> T.
>>>
>>> T.
>>>
>>>
>>> On Wed, Nov 4, 2015 at 11:18 PM, Tamas Nepusz <address@hidden> wrote:
>>>>> Why does igraph use floating point data (C doubles) to represent graph
>>>>> vertices? It seems like an unusual choice and I would expect it to
>>>>> negatively affect performance. Is it an R heritage?
>>>> Errrrm... it used to be that way a (not so) long time ago; see this
>>>> thread on the mailing list:
>>>>
>>>> https://lists.nongnu.org/archive/html/igraph-help/2009-01/msg00119.html
>>>>
>>>> However, I have just checked the source code and igraph_integer_t is
>>>> now typedef'd to an int so this is probably not the case any more.
>>>>
>>>> T.
>>>
>>> _______________________________________________
>>> igraph-help mailing list
>>> address@hidden
>>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help