[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [igraph] Problem with igraph_simplify() for C
From: |
Quax, Rick |
Subject: |
RE: [igraph] Problem with igraph_simplify() for C |
Date: |
Wed, 16 Feb 2011 10:10:16 +0100 |
Ahh now I see. A bit strange that the first entry is always the node index, especially from igraph_adjedgelist_get which seems to do the same. I wouldn't expect it.
Thank you very much!
--Rick
-----Oorspronkelijk bericht-----
Van: address@hidden namens Gábor Csárdi
Verzonden: di 15-2-2011 17:09
Aan: Quax, Rick; Help for igraph users
Onderwerp: Re: [igraph] Problem with igraph_simplify() for C
PLease answer to the list. Thanks. "0 1" means that there is an edge
from vertex 0 to vertex 1.
A self loop means that the edge connects the vertex to itself, i.e. "0
0" would be a self loop.
Gabor
On Tue, Feb 15, 2011 at 5:03 PM, Quax, Rick <address@hidden> wrote:
>
> Dear Gabor,
>
> Thanks for your response.
>
> I thought 'simple' meant no self-loops? I see e.g. on the first line
> (corresponding to node 0?) "0 1", which means that it has an edge to itself.
> Isn't that a self-loop?
>
> Thanks,
>
> Rick
>
> -----Oorspronkelijk bericht-----
> Van: address@hidden namens Gábor Csárdi
> Verzonden: di 15-2-2011 16:56
> Aan: Help for igraph users; Quax, Rick
> Onderwerp: Re: [igraph] Problem with igraph_simplify() for C
>
> Dear Rick,
>
> your network is already simple, i.e. it does not have any loop or
> multiple edges. So there is nothing to do for igraph_simplify().
>
> Gabor
>
> On Tue, Feb 15, 2011 at 3:29 PM, Quax, Rick <address@hidden> wrote:
>>
>> Dear all,
>>
>> I try to use the function igraph_simplify() in C to remove self-loops and
>> double edges, but it leaves the network unchanged. It does not matter what
>> I
>> pass as boolean arguments to it (true/false/0/1). I use igraph 0.5.4 and
>> g++
>> 4.1.2. The following is the relevant piece of code:
>>
>> -------------------------------------------------------
>> igraph_t graph;
>> size_t dim = 1, L = 20;
>> double p = 0.15;
>>
>> int ret = igraph_watts_strogatz_game(&graph, dim, L, nbh, p);
>>
>> igraph_write_graph_edgelist(&graph, stdout);
>>
>> ret = igraph_simplify(&graph, 1, 1);
>>
>> cout << "-----------------------------------\n";
>>
>> igraph_write_graph_edgelist(&graph, stdout);
>> -------------------------------------------------------
>>
>> The output of this code is the following (i.e., unchanged):
>>
>> --------------------------------------------------------
>> 0 1
>> 1 2
>> 2 3
>> 3 4
>> 3 19
>> 4 5
>> 5 6
>> 6 7
>> 7 8
>> 8 9
>> 9 10
>> 10 11
>> 11 12
>> 12 13
>> 13 14
>> 14 15
>> 15 16
>> 16 17
>> 17 18
>> 18 19
>> -----------------------------------
>> 0 1
>> 1 2
>> 2 3
>> 3 4
>> 3 19
>> 4 5
>> 5 6
>> 6 7
>> 7 8
>> 8 9
>> 9 10
>> 10 11
>> 11 12
>> 12 13
>> 13 14
>> 14 15
>> 15 16
>> 16 17
>> 17 18
>> 18 19
>> --------------------------------------------------------
>>
>> Does anyone have a clue why this happens? In R it does work.
>>
>> Thank you very much in advance,
>>
>> Rick
>>
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>>
>
>
>
> --
> Gabor Csardi <address@hidden> UNIL DGM
>
>
--
Gabor Csardi <address@hidden> UNIL DGM