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"), ...)
pajek
, graphml
, dot
,
gml
, edgelist
, lgl
,
ncol
and dimacs
are implemented. As of igraph 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
additional arguments.read.graph
for
details. Appropriate vertex and edge attributes are also written to
the file. This format has no additional arguments.read.graph
for GraphML details. Vertex and edge
attributes are also written to the file. This format has no additional
arguments.read.graph
g <- graph.ring(10)
write.graph(g, "/tmp/g.txt", "edgelist")
Run the code above in your browser using DataLab