Erich Peterson
Erich Peterson

Reputation: 861

Output All Edges of iGraph in R to XML

I'm wanting to output all edges in a iGraph g to an XML file, which looks something like this:

<edges>
    <edge from="1" to "2" />
    <edge from="1" to "4" />
    ...
</edges>

I know I can get the list of edges using E(g), but I don't know how to grab each individual to and from for each edge to output to XML.

Also, I have set the name attribute for all vertices, and need to output their name---not their id.

Could someone give my some advice.

Thanks.

Upvotes: 1

Views: 547

Answers (1)

Btibert3
Btibert3

Reputation: 40126

Check out ?write.graph within R. The igraph package can export graph objects to a variety of formats.

Upvotes: 2

Related Questions