ok, found it:

mapply(setdiff, nei2, nei1)

thanks,
Simone

2013/2/1 Simone Gabbriellini <[email protected]>:
> Hi Gabor,
>
> thanks for the info, I got the logic... still have a difficult with
> basic R commands, I suppose, because I don't know how to filter two
> lists of lists, i.e. the result of neighborhood():
>
> nei1<-neighborhood(g, 1, V(g)[which(V(g)$type==FALSE)])
> nei2<-neighborhood(g, 2, V(g)[which(V(g)$type==FALSE)])
>
> then I tried:
>
> V(g)[which(V(g)$type==FALSE)]$nei2<-nei2[which(nei2!=nei1)]
>
> or
>
> V(g)[which(V(g)$type==FALSE)]$nei2<-lapply(nei2, setdiff, nei1)
>
> with no success... tried to google it, but no luck either... If you
> have suggestions, I'll be happy to hear...
>
> Best,
> Simone
>
> 2013/1/31 Gábor Csárdi <[email protected]>:
>> Hi Simone,
>>
>> On Thu, Jan 31, 2013 at 11:14 AM, Simone Gabbriellini
>> <[email protected]> wrote:
>>>
>>> Hello List,
>>>
>>> I have a question regarding graph.knn() if applied on bipartite
>>> networks. When I calculate this:
>>>
>>> graph.knn(g, V(g)[type==FALSE])
>>>
>>> $knn
>>>      u43      u62       u9      u17      u19     u102     u127
>>> u142      u64     u137
>>> 3.750000 4.250000 4.181818 4.571429 5.600000 5.200000 6.000000
>>> 5.333333 5.166667 6.000000
>>
>> [...]
>>
>>>
>>> what these numbers represents? for each node of set1, I have the
>>> average degree of the nodes in set2?
>>
>>
>> The average degree of the neighbors of the node. Since your graph is
>> bipartite, yes, all these neighbors are in set 2.
>>
>>>
>>> if yes, is it possible to extend
>>> this concept to check for the average degree of dist-2 neighbors -
>>> i.e. nodes still belonging to set1?
>>
>>
>> Yes, but this is not in igraph and you need to code it for yourself,
>> probably using neighborhood() is easiest. For bipartite graphs it might be
>> very easy, actually, because all you need to do for a vertex in set 1 is
>> taking an order 2 neighborhood, and then removing all vertices from set 2
>> (first neighbors) and the maybe the node itself, and you end up with the
>> dist-2 neighbors.
>>
>> G.
>>
>>>
>>>
>>> Many thanks,
>>> Simone
>>>
>>>
>>> --
>>> Simone Gabbriellini, PhD
>>>
>>> PostDoc@DISI, University of Bologna
>>> mobile: +39 340 39 75 626
>>> email: [email protected]
>>> home: www.digitaldust.it
>>>
>>> DigitalBrains srl
>>> Amministratore
>>> mobile: +39 340 39 75 626
>>> email: [email protected]
>>> home: www.digitalbrains.it
>>>
>>> _______________________________________________
>>> igraph-help mailing list
>>> [email protected]
>>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>>
>>
>>
>> --
>> Gabor Csardi <[email protected]>     MTA KFKI RMKI
>>
>> _______________________________________________
>> igraph-help mailing list
>> [email protected]
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>
>
>
> --
> Simone Gabbriellini, PhD
>
> PostDoc@DISI, University of Bologna
> mobile: +39 340 39 75 626
> email: [email protected]
> home: www.digitaldust.it
>
> DigitalBrains srl
> Amministratore
> mobile: +39 340 39 75 626
> email: [email protected]
> home: www.digitalbrains.it



-- 
Simone Gabbriellini, PhD

PostDoc@DISI, University of Bologna
mobile: +39 340 39 75 626
email: [email protected]
home: www.digitaldust.it

DigitalBrains srl
Amministratore
mobile: +39 340 39 75 626
email: [email protected]
home: www.digitalbrains.it

_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to