Best format for exporting igraph network for use in other software (e.g. ORA for dynamic networks)?

I’m just starting to look into dynamic networks, especially looking at changes in edge weights over time. I plan to export individual igraph networks to ORA (but I do not think this end point is key to my question) and assemble them into the dynamic network.

(For details on ORA, see Projects - *ORA-LITE | CASOS which begins with:
"ORA-LITE is a dynamic meta-network assessment and analysis tool developed by CASOS at Carnegie Mellon. It contains hundreds of social network, dynamic network metrics, trail metrics, procedures for grouping nodes, identifying local patterns, comparing and contrasting networks, groups, and individuals from a dynamic meta-network perspective. *ORA-LITE has been used to examine how networks change through space and time … ")

I want to use write_graph() to export an igraph network to a file format that retains

  1. node name/id (very useful),
  2. edge weight (quite useful),
  3. node size (not essential, but desirable as this may change over time).

After some experimentation I’ve found that exporting to Pajek format (.paj) gives me 1. and 2. when I open the file in ORA. (I can’t see how to get 3, but I’ve never used Pajek and might be ignorant in my experiments.) Writing to .graphml gives me 2. and 3. when I open the file in ORA. At the moment I’m leaning towards the Pajek approach.

I saw this post on .graphml/node ids from seven years ago:

suggesting that some processing of node ids in the .graphml was the way to proceed.

I will be looking at some pretty large dynamic networks soon, a few thousand nodes over each of maybe 20 years. I am looking for suggestions on how to proceed efficiently.

What is ORA? Can you give a link or explanation?

I’ve edited the original question, but I do not think that the end point of ORA is key to my question.

Well, the title of your question is “Best format for exporting igraph network for use in ORA?” …

Of the formats igraph supports, GraphML, GML, DOT and Pajek all support arbitrary edge and vertex attributes, so they can store what you are asking for and more. GraphML is probably the most widely supported.

I am not familiar with ORA, so I do not know what it can read and how it can interpret data from these formats.

How to map a certain attribute to vertex size in ORA would be a question that is unrelated to igraph, and is specific to ORA.

Well, maybe, or perhaps I have an issue with setting the igraph vertex size in a form that’s incorporated into the .paj file when I use write_graph()? Any tips on this?

A fair point. As my understanding has matured a little, I’ve edited the question.

Let me try to rephrase. Graph formats which are designed to be flexible, and not tied to a specific piece of software, can typically store arbitrarily named vertex and edge attributes. In general, there is no way to store “vertex size”, with a guarantee that any software that opens the file will immediately use that to adjust size. However, a software that can plot graphs may be able to map any vertex attribute of your choice to size when plotting. (igraph can do this.)

I do not know ORA at all, but based on my experience with other software, I would try these in order:

  • Figure out how to map an arbitrary vertex attribute to size in ORA.
  • If that is not possible, I would look at what ORA calls the attribute that it interprets as “size” (by e.g. exporting a graph with different vertex sizes to GraphML from ORA and looking into the file), and use the same attribute name in igraph.
  • DOT is specific to Graphviz and Pajek is specific to, well, Pajek. Both of these software can visualize graphs. Therefore, maybe these do have a standard name for the attribute they interpret as size. If they do, maybe ORA also interprets it as size. I might try this as a last resort.

I hope this helps.

I think I have definitely introduced a “red herring” in ORA, sorry. I think the main issue is that exporting some igraph to Pajek format is easiest to work with for my needs, but I can’t see how to include vertex information in a .paj file. (Alternatively, exporting to .graphml associates igraph’s V(g)$size with a v_size field for each vertex.)
Here’s a short R example that shows my failure:

library(igraph)
g <- graph.star(10)
V(g)$name <- letters[1:10]
# Pajek doesn't recognise these names, so use a new attribute to set vertex ids -  these show up in the exported Pajek file
V(g)$id <- as.character(V(g)$name)
# Set some arbitrary edge weights for illustration -  these also show up in the exported file.
E(g)$weight <- seq(1:length(E(g)))*2.5
# This attempt to change the vertex sizes doesn't have any effect in the output file
V(g)$size <- as.numeric(seq(1:length(V(g)))*5)
# Pajek documentation suggests vertex sizes are set with "s_size", but this new attribute also does not appear in the exported file:
V(g)$s_size <- V(g)$size
Write graph g to a Pajek file
igraph::write_graph(g, file =test , format = "pajek")

produces a file with contents that omit the new attributes
*Vertices 10
1 “a”
2 “b”
3 “c”
4 “d”
5 “e”
6 “f”
7 “g”
8 “h”
9 “i”
10 “j”
*Arcs
2 1 2.5
3 1 5
4 1 7.5
5 1 10
6 1 12.5
7 1 15
8 1 17.5
9 1 20
10 1 22.5

Obviously some of my attempts to add attributes were successful (edge weight, vertex id). I think I need an igraph → Pajek dictionary. Does anyone have suggestions?

(EDIT: Pajek handles vertex attributes through a separate .vec file. However, we can re-purpose the x-coordinate or y-coordinate columns of a .paj file to hold vertex size. I can successfully use one of these attributes in resizing my vertices in ORA (setting V(g)$x or V(g)$y to my intended sizes). A bit clunky, but might have to do until someone comes up with something more clever.)