0

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.

Anna Yashina
  • 514
  • 8
  • 18

1 Answers1

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