2

I am trying to convert an iGraph object to a gexf object using the rgexf package so that I can write a file usable with Gephi, which I prefer for network visualization.

My iGraph object is created by reading in two CSVs: h.edges and h.nodes. There are both edge and node attributes. Once the files are read in, I create the iGraph object, calculate centrality measures and then attach the centrality measures as node attributes. The code looks like so:

iNet = graph_from_data_frame(d=h.edges, vertices = h.nodes, directed = F)
V(iNet)$degree = degree(iNet)                        
V(iNet)$eig = evcent(iNet)$vector   
V(iNet)$betweenness = betweenness(iNet)

This appears to be working fine since I can do all the normal iGraph functions -- plot, calculate centralities, identify communities, etc. My problem comes when I try to convert this to a gexf object. I run the following code:

library(rgexf)
iNet.gexf  igraph.to.gexf(iNet)

But get the below error message:

Error in `[.data.frame`(x, r, vars, drop = drop) : 
  undefined columns selected

Anyone know what's happening? Although I know the example here can all be done just by uploading the two CSVs straight to Gephi and running the calculations there, the end goal is to be able to attach iGraph's more robust calculations as attributes in ways that Gephi can't.

CowCookie
  • 51
  • 4

0 Answers0