igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] Import edgelist with isolates


From: Dr. Tim Elrick
Subject: [igraph] Import edgelist with isolates
Date: Fri, 17 May 2013 12:28:23 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]