Class GraphMLSerializer<TVertex, TEdge, TGraph>
A GraphML (http://graphml.graphdrawing.org/) format serializer.
Inherited Members
Namespace: QuikGraph.Serialization
Assembly: QuikGraph.Serialization.dll
Syntax
public sealed class GraphMLSerializer<TVertex, TEdge, TGraph> : SerializerBase where TEdge : IEdge<TVertex> where TGraph : IEdgeListGraph<TVertex, TEdge>
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
TGraph | Graph type. |
Remarks
Custom vertex, edge and graph attributes can be specified by using the System.Xml.Serialization.XmlAttributeAttribute attribute on properties (field not supported).
The serializer uses LCG (lightweight code generation) to generate the methods that writes the attributes to avoid paying the price of Reflection on each vertex/edge. Since nothing is for free, the first time you will use the serializer *on a particular pair of types*, it will have to bake that method.
Hyper edge, nodes, nested graphs not supported.
Methods
| Improve this Doc View SourceSerialize(XmlWriter, TGraph, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>)
Serializes the given graph
instance into the given writer
.
Declaration
public void Serialize(XmlWriter writer, TGraph graph, VertexIdentity<TVertex> vertexIdentity, EdgeIdentity<TVertex, TEdge> edgeIdentity)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | writer | The XML writer. |
TGraph | graph | Graph instance to serialize. |
VertexIdentity<TVertex> | vertexIdentity | Vertex identity method. |
EdgeIdentity<TVertex, TEdge> | edgeIdentity | Edge identity method. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.InvalidOperationException | Failure while writing elements to GraphML. |
System.NotSupportedException | Serializing value on property without getter, or with unsupported property type. |