Hi,
I'm writing a simple script of a function to find the giant connected component in a percolated graph. On igraph-help mail lists I've stumbled upon two different ways of doing that:
- First one:
giant.component <- function(graph, ...) {
cl <- clusters(graph, ...)
subgraph(graph, which(cl$membership == which.max(cl$csize)-1)-1)
}
- Second one:
graphs <- decompose.graph(g)
largest <- which.max(sapply(graphs, vcount))
However, they gave two different results (actually, first one they couldn't find any giant component though there was one there). 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)?
Best wishes.
İbrahim Mutlay