igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] help about extracting the largest connected component


From: Ali Ilhan
Subject: Re: [igraph] help about extracting the largest connected component
Date: Wed, 16 May 2018 15:32:52 +0300

Dear all,

Sorry for taking your time again, but I solved the issue, I think it is a version issue, the working code is below:

giant.component <- function(graph) { 
cl <- clusters(graph) 
induced.subgraph(graph, which(cl$membership == which.max(cl$csize)))} 

Thanks again,

ali

On Wed, May 16, 2018 at 2:33 PM, Ali Ilhan <address@hidden> wrote:
Dear all,

I am pretty new to igraph and R, and having some difficulties (long time Stata and SAS user). I have a graph of roughly 32000 vertices, which has a largest component of around 6200 connected nodes. All I want to do is to extract this as a new igraph object, and calculate some basic network metrics such as  density, mean degree centrality etc. 

I have tried to various things which have been suggested before in this list, such as:

giant.component <- function(graph, ...) {
  cl <- clusters(graph, ...)
  subgraph(graph, which(cl$membership == which.max(cl$csize)-1)-1)
}

tail.component <- function(graph, ...) {
  cl <- clusters(graph, ...)
  subgraph(graph, which(cl$membership != which.max(cl$csize)-1)-1)
}

But could not get the code to work. I have been mainly playing with induce.subgraph and decompose.

Any help is greatly appreciated.

Warm wishes,
ali


reply via email to

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