r - Creating an igraph attribute overview -


i'd know if there possibility data frame igraph element includes vertex attributes colnames. looks trivial thing not able work far.

cbind(v(igraphe)$attr_1, v(igraphe)$attr_2, v(igraphe)$attr_3, v(igraphe)$attr_4) 

and of course have access attribute names via

 list.vertex.attributes(igraphe) 

there has way accomplish - maybe of knows how it.

edit: example

test_fun <- function(color1,color2,len){   vec <- replicate(len,sample(c(color1,color2,na),1))   return(vec) }  set.seed(50) num_nodes<- 20 test_graph <- erdos.renyi.game(num_nodes, 1/6) v(test_graph)$color_1 <- test_fun("darkgreen","blue",num_nodes) v(test_graph)$color_2 <- test_fun("brown","blueviolet",num_nodes) v(test_graph)$color_3 <- test_fun("red","green",num_nodes) v(test_graph)$color_4 <- test_fun("red","green",num_nodes) plot(test_graph, vertex.size=7) 

expected result: data.frame including vertex attributes, attributes colnames

to whom may concern - found answer myself. indeed simple , streightforward:

df <- as.data.frame(vertex.attributes(test_graph)) 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -