igraph-help
[Top][All Lists]
Advanced

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

[igraph] parallel processing


From: Bita Shams
Subject: [igraph] parallel processing
Date: Mon, 8 Oct 2012 12:10:42 -0700 (PDT)

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();

reply via email to

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