Set multiple attributes to one node in R
1
0
Entering edit mode
4.0 years ago
Vania ▴ 10

I am using igraph to construct a networks. But I have a doubt, I have nodes with 3 different attributes (On, Off and Unknown). For example:

N1  ON
N1  OFF
N2  UNKNOWN
N2  ON
N2  OFF

How can I set the three different attributes in the same node?

R igraph • 1.9k views
ADD COMMENT
0
Entering edit mode

Something like this ?

library(igraph)
df=read.table("bio.txt", header=FALSE)
g=graph_from_data_frame(df)
plot(g)

Check igraph docs to modify network.

ADD REPLY
0
Entering edit mode

I don't think this answer the question. As I understand it, OP wants to have multiple values as an attribute.

ADD REPLY
0
Entering edit mode

I was also little skeptical about my understanding about the question (hence the ?).

ADD REPLY
3
Entering edit mode
4.0 years ago

You can use a vector as an attribute, something like:

g <- set.vertex.attribute(g, 'status', "N2", list(c("ON", "OFF", "UNKNOWN")))
ADD COMMENT
0
Entering edit mode

This is exactly what I was looking for. Thank you so much and sorry for my bad redaction, I am new in this site.

ADD REPLY

Login before adding your answer.

Traffic: 1514 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6