I have an unweighted edge list which I need to convert to a symmetric matrix for futher analysis. I use igraph
function graph.data.frame()
to create a graph object. Unfortunatelly I can't find a way to convert dgCMatrix
to a matrix or creat a matrix right from the edge list. I'm sure there should be a simple way to do it.
Asked
Active
Viewed 3,555 times
0

Anna Yashina
- 514
- 8
- 18
1 Answers
2
If your graph.data.frame is GDF then you can get a sparse data matrix from
as_adjacency_matrix(GDF)
This is the dgCMatrix that you mention. But now you can just use
as.matrix(as_adjacency_matrix(GDF))
if you want the full matrix.

G5W
- 36,531
- 10
- 47
- 80