igraph-help
[Top][All Lists]
Advanced

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

[igraph] preserving multiple graphs


From: Uri Shwed
Subject: [igraph] preserving multiple graphs
Date: Sun, 10 Feb 2008 19:45:19 -0500

Hi Gabor and all,
I'm trying to analyze the unfolding of a network over time, using cohesive blocks. Since towards the end of my time frame the network becomes quite huge, I thought it would be useful to first store all the graphs into a list, and then cohesive.blocks the periods separately. This has taught me that lists don't store graphs - is that true? How do one stores graphs then? I wouldn't mind even saving them as separate files, but I do need a way to give those files serial names automatically. I hope I'm making some sense...I'm just doing my first baby steps in R. Here's the code I have:


##this function takes data of 3 columns - sender(citing), receiver (cited) and year(citey), and uses a moving window to build many networks, and store them by the first year in the window .

window.matgrf<-function(data, start=1950, end=1990, lag=8) {
        t<-start
        lag<-lag
        end<-end
        last<-end-lag
        years<-start:end
        lis<<-list(year=NA,mtrx=NA,grf=NA)
lstname<<-list(year=NA,mtrx=NA,grf=NA,blks=NA,blkgrf=NA) //This is for future use with faster machines - maybe I could get the blocks on this run.
        for (t in start:last) {
mtx<-matrix(c(data$citing[data$citey>=t & data$citey <=t+lag], data$cited [data$citey >=t & data$citey
                <=t+lag]), ncol=2)
                print(t)
                grfy<-graph.edgelist(mtx)
                print(is.igraph(grfy))
                lis<-list(year=t, matrx=mtx,grf=grfy)
                lstname[t]<<-list(lis)
                t<-t+1

                }
        lstname
         }
##so to build a list called Set:

 Set<-window.matgrf(FullData, end=1994)
## and then to get the cohesive blocks for 1977 -  1985:
cohesive.blocks(Set[[1975]][2])





reply via email to

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