Writing the graph to a file in some format
write.graph is a general function for exporting
graphs to foreign file formats, however not many formats are
implemented right now.
write.graph(graph, file, format=c("edgelist", "pajek", "ncol", "lgl", "graphml", "dimacs", "gml", "dot", "leda"), ...)
- The graph to export.
- A connection or a string giving the file name to write the graph to.
- Character string giving the file format. Right now
dimacsare implemented. As of igraph
- Other, format specific arguments, see below.
- A NULL, invisibly.
Edge list format
edgelist format is a simple text file, with one edge in a
line, the two vertex ids separated by a space character. The file is
sorted by the first and the second column. This format has no
The Pajek format is a text file, see
details. Appropriate vertex and edge attributes are also written to
the file. This format has no additional arguments.
The GraphML format is a flexible XML based format. See
read.graph for GraphML details. Vertex and edge
attributes are also written to the file. This format has no additional
The dot format is used by the popular GraphViz program. Vertex and edge attributes are written to the file. There are no additional arguments for this format.
Adai AT, Date SV, Wieland S, Marcotte EM. LGL: creating a map of protein function with an algorithm for visualizing very large biological networks. J Mol Biol. 2004 Jun 25;340(1):179-90.
g <- graph.ring(10) write.graph(g, "/tmp/g.txt", "edgelist")