Using Igraph, I create shortest paths, then convert the matrix into three column vectors - "vertex1", "vertex2", "shortestpath" - as the code below shows.
#code for generating shortest path matrix and creating a 3 columns from an igraph graph object "y" y_s<-shortest.paths(y, weights = NULL) y_s <- melt(y_s)[melt(upper.tri(y_s))$value,] #Step 2: this is where the trouble with memory occurs y_s[,1] <- V(y)$name[y_s[,1]] y_s[,2] <- V(y)$name[y_s[,2]] names(y_s)<-c("vertex1", "vertex2", "shortestpath") However I am looking for an alternative way of doing this becase at the second step I run into a fight with my machine's memory. I know I can create vectors using as.vector(), c(), etc, but I am not able to create the two other columns with vertex names. Best regards, Joe. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.