I am using igraph in R to calculate some network centrality measures. Once the measures are ready, I want to write the graph into a file in the Pajek format.
V(net)$deg_net <- degree(net, loops = F)
V(net)$cls_net <- closeness(net)
now the network "net" looks like this"
>net
IGRAPH UNW 80000 240000 --
+ attr: name (v/c), deg_net (v/n), cls_net (v/n), weight (e/n)
+ edges (vertex names):
.
.
.
When I use
write.graph(net, "team_measures.txt", "pajek")
the final text file doesn't seem to include any information about the vertices, including their attributes (degree and closeness measures). It just is:
*Vertices 80000
*Edges
1 1555 1
1 6153 1
1 785 1
and so on. Am I doing something wrong?
I should also mention that "net" is a one-mode projection of a bipartite network.
OK! This is how I did it (far from optimal way!):
V(net)$deg_net <- degree(net, loops = F)
V(net)$cls_net <- closeness(net)
options(max.print=1000000)
sink("degree.txt")
V(net)$deg_net
sink()
sink("closeness.txt")
V(net)$cls_net
sink()
Then took the text files and did some editing in excel and saved the files as csv. Please let me know if you can think of a better way. Thank you,