I am using tf_idf value to determine similarity between webpages.Till now I have my tf_idf matrix which is not square as there are many keywords but only 36 document .I want to convert this matrix to graph object so that i can take one mode projection for the same.
So i am using this
ig <- graph.adjacency(tf_idf,mode="undirected",weighted=TRUE)
.I want this to be weighted which is it's tf_idf value.
But,when i do this it throw an error,
Error in graph.adjacency.dense(adjmatrix, mode = mode, weighted = weighted, : not a square matrix
Can you please help me in to decide how to proceed then.
I have matrix something like this where x,y,z is keyword and A,b is webpage
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
tf_idf
isn't an adjacency matrix. Thus, it isn't clear what you are trying to do. – John Colemantf_idf
is part of an adjacency matrix. You could expand it to a full matrix. – John Colemangraph_from_incidence_matrix
, which may help, although your input is a bit unclear (at least to me) - can you share a small example of your data ? Or perhaps you want to take the crossproduct of your matrix (for common words) so its square or ..? – user20650