I have a large igraph object that has several edge and vertex attributes that i need to write to a file and load again later (probably by a different program like python).

> g
IGRAPH DN-- 85000 1000000 -- 
+ attr: name (v/c), numeric_var (e/n), binary_outcome1 (e/x), binary_outcome2 (e/x)

so what format should i use to be able to write all the edge attributes to the file format?

write.graph(g, file = "test1.fileextension",format = "which_format?")

Thanks very much!

有帮助吗?

解决方案

The pros & cons of the various supported formats are documented pretty well in the R igraph read.igraph help file: http://igraph.sourceforge.net/doc/R/read.graph.html. The write.igraph page shows support for more types of output

  • Edge List is too simple for your needs
  • Pajek may be too domain-specific and has some similar limitations to GraphML
  • Dot might be able to do what you need (ref: http://www.graphviz.org/Documentation/dotguide.pdf)
  • GraphML wont' deal with hypergraphs, nested graphs or mixed (directed/undirected) graphs.
  • GML says that "only node and edge attributes are used, and only if they have a simple type: integer, real or string. So if an attribute is an array or a record, then it is ignored. This is also true if only some values of the attribute are complex."
  • DL is prbly not going to work for you.
  • NCOL is "simply a symbolic weighted edge list" so it's prbly out, too.
  • LGL is also prbly too simple to work.
  • DIMACS doesn't have the extra info you need.
  • LEDA (I believe) only supports single attributes.
  • GraphDB also has limitations.

So, I'd give either GraphML and GML a go.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top