Displaying 1 result from an estimated 1 matches for "y_s".
Did you mean:
_s
2011 Aug 05
1
matrix into vector with vertex names
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")
Howev...