Axel Axel
Axel Axel

Reputation: 65

R igraph add.edges() with attributes

Assign during add.edges() an attribute, like width:

g <- add.edges(g,c(from,to), attr= width <- 1 ) 

Error message:
please supply names for attributes

Upvotes: 2

Views: 5141

Answers (1)

Sacha Epskamp
Sacha Epskamp

Reputation: 47541

You need to assign it a named list:

g <- graph.adjacency(matrix(0,2,2))
g <- add.edges(g,c(1,2),attr=list(width=10))

With the code you used you assign 1 to a variable width and then assign the value of width, i.e. 1, to the argument attr.

Upvotes: 5

Related Questions