0

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 (say 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.

3
  • gephi.org says Attributes support is however missing, only the network topology can be represented with a Pajek File.
    – G5W
    Jan 21, 2017 at 17:42
  • is there anyway I can export vertices and their attributes? I need them for my analysis.
    – Reza
    Jan 21, 2017 at 17:51
  • A different page at gephi describes the properties of different file formats.
    – G5W
    Jan 21, 2017 at 17:55

1 Answer 1

0

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,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.