igraph-help
[Top][All Lists]
Advanced

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

[igraph] Getting components counts for many network files


From: Dawn
Subject: [igraph] Getting components counts for many network files
Date: Tue, 4 Aug 2015 11:13:57 -0700

Hi there,

I am trying to calculate the number of components for 43 networks under the 43cc directory. Here is my code:
------------------------------------------------
library(igraph)
get.pc <- function(file){
g<-read.graph("file", format="ncol")
cc_all<-decompose.graph(g,min.vertices=2)
aa=length(cc_all)
}

fileList <- list.files(path="43cc", pattern=".txt")
lapply(fileList,get.pc)
----------------------------------------------------
I got the following error:
Error in .Call("R_igraph_read_graph_ncol", file, as.character(predef),  :
  At rinterface.c:4923 : Cannot read edgelist, File operation error

The function get.pc should be correct because it worked for one file, as below:
> g<-read.graph("43cc/34DCM.txt", format="ncol")
> cc_all<-decompose.graph(g,min.vertices=2)
> aa=length(cc_all)
> aa
[1] 2

Thank you!
Dawn



reply via email to

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