igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] subgraph by passing list of nodes that grabs also nodes po


From: Gábor Csárdi
Subject: Re: [igraph] subgraph by passing list of nodes that grabs also nodes pointing to that list
Date: Thu, 14 May 2009 17:34:10 +0200

On Thu, May 14, 2009 at 4:52 PM, Jose Quesada <address@hidden> wrote:
[...]
> Yes I do. But in any case, I've tried all combinations of in, out and
> all in both graph.incidence and neighborhood and I either get the lone
> node or the list.
> One particular thing about the list: the ids there are _not_  actor nor
> movies in this toy subgraph.

What are they, then? I am not sure what you expect here.

> V(tg)[ 1377253 ]$type
[1] FALSE
vv <- neighborhood(tg, order=1, 1377253, mode="out")
> V(tg)[ vv[[1]] ]$type
 [1] FALSE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
[13]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
[25]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
[37]  TRUE  TRUE  TRUE

Here the first FALSE is vertex 1377253 itself, and the rest of the
vertices have the opposite type.

> Something weird is going on here. I'm not
> sure how to debug this problem...

I really don't see the problem. If you just take a look at the graph,
you'll see that there are many edges starting at vertex 1377253. You
can even list these edges, if you like:

> E(tg)[ from(1377253) ]
Edge sequence:

[0]  1377253 -> 1413423
[2]  1377253 -> 1457015
[3]  1377253 -> 1464520
[6]  1377253 -> 1517383
[10] 1377253 -> 1641295
[11] 1377253 -> 1704978
[13] 1377253 -> 1741976
[16] 1377253 -> 1744269
[17] 1377253 -> 1744274
[18] 1377253 -> 1744315
[19] 1377253 -> 1745028
[20] 1377253 -> 1745031
[23] 1377253 -> 1756801
[24] 1377253 -> 1783566
[27] 1377253 -> 1803739
[29] 1377253 -> 1836911
[30] 1377253 -> 1836953
[31] 1377253 -> 1836954
[32] 1377253 -> 1836964
[33] 1377253 -> 1836967
[34] 1377253 -> 1844560
[35] 1377253 -> 1848929
[37] 1377253 -> 1880207
[42] 1377253 -> 1946456
[44] 1377253 -> 2132881
[47] 1377253 -> 2203538
[49] 1377253 -> 2278148
[50] 1377253 -> 2282809
[52] 1377253 -> 2324406
[57] 1377253 -> 2409592
[58] 1377253 -> 2409595
[59] 1377253 -> 2410120
[60] 1377253 -> 2410900
[66] 1377253 -> 2681118
[77] 1377253 -> 2946503
[78] 1377253 -> 2946504
[79] 1377253 -> 2946655
[80] 1377253 -> 2974742
> length(E(tg)[ from(1377253) ])
[1] 38

> I'm having a lot of trouble to do what seemingly are very simple tasks.
> This is surprising. Is there anything like head() that works for igraph
> objects?

What whould head() do? What is wrong with

summary(tg)
head(get.edgelist(tg))

In your case, you just have 81 edges, so you can just print them all
by typing the name of the object and ENTER. Ie.

> tg
...

G.

> I'm using
> write.table(ids, "clipboard", sep='\t') and pasting into a spreadsheet
> to get something more visual. I'm sure there are better ways to operate
> with igraph objects...
>
> Thanks!
>
>
>> G.
>>
>>
>>> Thanks!
>>> -Jose
>>>
>>>> subgraph(g, unique(unlist(vv)))
>>>>
>>>> Best,
>>>> Gabor
>>>>
>>>>
>>> --
>>> Jose Quesada, PhD.
>>> Max Planck Institute,
>>> Center for Adaptive Behavior and Cognition -ABC-,
>>> Lentzeallee 94, office 224, 14195 Berlin
>>> http://www.josequesada.name/
>>>
>>>
>>> _______________________________________________
>>> igraph-help mailing list
>>> address@hidden
>>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>>>
>>>
>>>
>>
>>
>>
>>
>
>
> --
> Jose Quesada, PhD.
> Max Planck Institute,
> Center for Adaptive Behavior and Cognition -ABC-,
> Lentzeallee 94, office 224, 14195 Berlin
> http://www.josequesada.name/
>
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>



-- 
Gabor Csardi <address@hidden>     UNIL DGM




reply via email to

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