I want to add edges to an empty graph . I could do it sequentially but<b> no edge is added</b> to the graph when I tried to add edges parallel!!!! ( I tested both "doMC" and "doParallel" Package)
I wrote my parallel and sequential commands and I'll be really thankful if anybody helps me.
parallel
code
parConvert<- function(){
g<-graph.empty(100);
foreach(i= 1:10)%dopar%{<nabble_img src="" border="0"/>
for( j in (1:10)){
g<-g+edges(i,(j+10));
}
}
return(g);
}
cl<- makeCluster(4);
registerDoParallel();
clusterExport(cl,"edges")
g<- parConvert();
# sequential code:
convert<- function(){
g<-graph.empty(100);
foreach(i= 1:10)%do%{
for( j in (1:10)){ g<-g+edges(i,(j+10));} }
return(g);
}
p<- convert();