[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [igraph] Number of isolated nodes in the network

**From**: |
Claudia Muller-Birn |

**Subject**: |
Re: [igraph] Number of isolated nodes in the network |

**Date**: |
Thu, 5 Aug 2010 11:55:45 -0400 |

Hi Jordi,
Thank you, this was very helpful :) I had exactly the same idea and a minute
later your email arrived. Perfect timing.
Maybe this solution helps others as well, but be aware of loops! For example in
my networks I had to simplify the graph first:
g <- simplify(g, remove.multiple = TRUE, remove.loops = TRUE)
Otherwise, loops are considered and therefore, the degree is higher than zero.
Thanks again.
Have a great day.
Claudia
On Aug 5, 2010, at 10:56 AM, jordi torrents wrote:
>* Hi Claudia,*
>* *
>* 2010/8/5 Claudia Muller-Birn:*
>*> Dear all,*
>*> *
>*> I might have a fairly simple question but I have difficulties to solve my *
>*> problem this time.*
>*> I'd like to compute the number of isolates nodes in a network. [...]*
>* *
>* The function below gives you a vector with the ids of nodes with*
>* degree 0 (ie isolates):*
>* *
>* isolates <- function(g){*
>* return(which(degree(g)==0)-1)*
>* }*
>* *
>* i <- isolates(g)*
>* length(i)*
>* *
>* Hope this helps.*
>* Salut!*
>* *
>* _______________________________________________*
>* igraph-help mailing list*
>* address@hidden*
>* http://lists.nongnu.org/mailman/listinfo/igraph-help*