[Top][All Lists]

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

[igraph] Two different ways of finding giant component

From: İbrahim Mutlay
Subject: [igraph] Two different ways of finding giant component
Date: Fri, 5 Apr 2013 13:02:49 +0300


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

reply via email to

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