igraph-help
[Top][All Lists]
Advanced

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

[igraph] edges "disapear", when creating graph in R


From: zbynek . janoska
Subject: [igraph] edges "disapear", when creating graph in R
Date: Fri, 12 Jul 2013 14:23:59 +0200

Hello, 
I have encountered following problem in R:
I construct graph from a matrix of edges, but resulting graph has fewer edges than there is rows in the matrix.

# edges are stored in a matrix M

> head(M)
     USEK1 USEK2
[1,]   985   866
[2,]   982   866
[3,]  1062  1039
[4,]  1088  1119
[5,]  1061  1088
[6,]  1060  1061

# matrix stores 3244 edges
> dim(M)
[1] 3244    2

# number of vertices
> max(M)+1
[1] 2404

> g <- graph.empty(n=max(M)+1,directed=T)
> g <- add.edges(g,M)
> g
IGRAPH D--- 2404 3242 --

#########

there are two edges missing.
Can anyone explain, what it the source of this behavior, and how can I fix it?

Best Regards,

Zbynek Janoska
Transport Research Centre
Olomouc, Czech Republic
address@hidden

reply via email to

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