I'm trying to export and then later import graphs with additional data added such as VertexLabels and EdgeLabels. When I export a graph, such as the following, and then import it, I find that some information has been lost.
g=Graph[{1->2,2->3,3->1},VertexLabels->"Name",VertexStyle->Purple,VertexShapeFunction->"Diamond"];
Export["graph.gml",g];
r=Import["graph.gml"]
This will maintain some of the options, e.g. VertexShapeFunction and VertexStyle, but will lose VertexLabels.
PropertyValue[r,VertexLabels]
The above returns {},showing that the data was not retained.
I have tried .graphml and .gxl formats as well, with the same issues.
Import["graph.gml",{{VertexLabels}}]
The above returns the following error:
Import::noelem: The Import element "VertexLabels" is not present when importing as Graphlet. >>
What is the best way to export and then import graphs while retaining all additional data?