I use the tf_idf value to determine the similarity between web pages. Now I have my tf_idf matrix, which is not square, as there are many keywords, but only 36 documents. I want to convert this matrix to a graph object so that I can take one for the same projection.
So, I use this ig <- graph.adjacency(tf_idf,mode="undirected",weighted=TRUE). I want this to be weighted, this is the tf_idf value.
But when I do this, it throws an error,
Error in graph.adjacency.dense (adjmatrix, mode = mode, weighted = weighted ,: not a square matrix
Could you help me decide how to proceed.
I have such a matrix, where x, y, z is the keyword and A, b is the web page
mat = matrix(c(0.1, 0.5, 0.9, 0.4, 0.3, 0.5), nc=3,
dimnames=list(c("A", "B"), c("x", "y", "z")),
byrow=TRUE)
x y z
A 0.1 0.5 0.9
B 0.4 0.3 0.5