[Top][All Lists]

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

Re: [igraph] Two different ways of finding giant component

From: Tamás Nepusz
Subject: Re: [igraph] Two different ways of finding giant component
Date: Fri, 5 Apr 2013 15:17:57 +0200

> - First one:
> giant.component <- function(graph, ...) {
>   cl <- clusters(graph, ...)
>   subgraph(graph, which(cl$membership == which.max(cl$csize)-1)-1)
> }
You don't have to subtract 1 from the result of which and which.max since 
igraph 0.6 if I remember correctly.

> Anyway, I decided that problem of the first function may be related to 
> obsolete igraph (1/0 indexing) version and then deleted both minus 1s that 
> gives the same result with the second one. But now I'm not sure whether that 
> makes sense, I mean which one of the above methods are more reliable to find 
> giant component (or is there a better way)?
Both are equivalent and correct if you omit the -1 from the first version. 
However, the first version is faster because it does not extract the remaining 
components for you while decompose.graph does that.


reply via email to

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