Hi,

I am trying to convert a matrix into an edgelist in R. However, I cannot find how I should treat isolates.

My matrix el looks like this
V1      V2
12345   29999
29999   34567
76543   NA

where the last row would represent an isolate.

When trying to use

g <- graph.edgelist(el, directed=F)

the result is the error

Error in graph(unname(ids[t(el)]), directed = directed) :
At type_indexededgelist.c:117 : cannot create empty graph with negative number of vertices, Invalid value

After having got that error I tried to replace the NAs with the same vertix id, so that I would get an edge like 1234 1234
However, this results in loop-edges and not isolates.

Any idea on how to treat isolates correctly? Thanks!

Tim

_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to