Class GraphMLExtensions
Extensions to help serializing/deserializing graph to/from GraphML.
Inheritance
Inherited Members
Namespace: QuikGraph.Serialization
Assembly: QuikGraph.Serialization.dll
Syntax
public static class GraphMLExtensions
Methods
| Improve this Doc View SourceDeserializeAndValidateFromGraphML<TVertex, TEdge, TGraph>(TGraph, TextReader, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
Deserializes from the given reader (GraphML graph) into the given graph
and checks if content is valid.
Declaration
public static void DeserializeAndValidateFromGraphML<TVertex, TEdge, TGraph>(this TGraph graph, TextReader reader, IdentifiableVertexFactory<TVertex> vertexFactory, IdentifiableEdgeFactory<TVertex, TEdge> edgeFactory)
where TEdge : IEdge<TVertex> where TGraph : IMutableVertexAndEdgeSet<TVertex, TEdge>
Parameters
| Type | Name | Description |
|---|---|---|
| TGraph | graph | Graph instance to fill. |
| System.IO.TextReader | reader | Reader stream. |
| IdentifiableVertexFactory<TVertex> | vertexFactory | Vertex factory method. |
| IdentifiableEdgeFactory<TVertex, TEdge> | edgeFactory | Edge factory method. |
Type Parameters
| Name | Description |
|---|---|
| TVertex | Vertex type. |
| TEdge | Edge type. |
| TGraph | Graph type. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
| System.ArgumentNullException |
|
| System.ArgumentNullException |
|
| System.ArgumentNullException |
|
| System.InvalidOperationException | Deserializing value on property without setter, or with invalid default value. |
| System.InvalidOperationException | QuikGraph.Serialization.XmlConstants.GraphMLTag or QuikGraph.Serialization.XmlConstants.GraphTag not found. |
| System.InvalidOperationException | Failure while reading elements from GraphML. |
| System.NotSupportedException | Deserializing graph with unsupported property type. |
DeserializeFromGraphML<TVertex, TEdge, TGraph>(TGraph, TextReader, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
Deserializes from the given reader (GraphML graph) into the given graph.
Declaration
public static void DeserializeFromGraphML<TVertex, TEdge, TGraph>(this TGraph graph, TextReader reader, IdentifiableVertexFactory<TVertex> vertexFactory, IdentifiableEdgeFactory<TVertex, TEdge> edgeFactory)
where TEdge : IEdge<TVertex> where TGraph : IMutableVertexAndEdgeSet<TVertex, TEdge>
Parameters
| Type | Name | Description |
|---|---|---|
| TGraph | graph | Graph instance to fill. |
| System.IO.TextReader | reader | Reader stream. |
| IdentifiableVertexFactory<TVertex> | vertexFactory | Vertex factory method. |
| IdentifiableEdgeFactory<TVertex, TEdge> | edgeFactory | Edge factory method. |
Type Parameters
| Name | Description |
|---|---|
| TVertex | Vertex type. |
| TEdge | Edge type. |
| TGraph | Graph type. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
| System.ArgumentNullException |
|
| System.ArgumentNullException |
|
| System.ArgumentNullException |
|
| System.InvalidOperationException | Deserializing value on property without setter, or with invalid default value. |
| System.InvalidOperationException | QuikGraph.Serialization.XmlConstants.GraphMLTag or QuikGraph.Serialization.XmlConstants.GraphTag not found. |
| System.InvalidOperationException | Failure while reading elements from GraphML. |
| System.NotSupportedException | Deserializing graph with unsupported property type. |
DeserializeFromGraphML<TVertex, TEdge, TGraph>(TGraph, String, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
Deserializes the given file at filePath (GraphML graph) into the given graph.
Declaration
public static void DeserializeFromGraphML<TVertex, TEdge, TGraph>(this TGraph graph, string filePath, IdentifiableVertexFactory<TVertex> vertexFactory, IdentifiableEdgeFactory<TVertex, TEdge> edgeFactory)
where TEdge : IEdge<TVertex> where TGraph : IMutableVertexAndEdgeSet<TVertex, TEdge>
Parameters
| Type | Name | Description |
|---|---|---|
| TGraph | graph | Graph instance to fill. |
| System.String | filePath | Path to the file to load. |
| IdentifiableVertexFactory<TVertex> | vertexFactory | Vertex factory method. |
| IdentifiableEdgeFactory<TVertex, TEdge> | edgeFactory | Edge factory method. |
Type Parameters
| Name | Description |
|---|---|
| TVertex | Vertex type. |
| TEdge | Edge type. |
| TGraph | Graph type. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
| System.ArgumentNullException |
|
| System.ArgumentNullException |
|
| System.ArgumentException |
|
| System.InvalidOperationException | Deserializing value on property without setter, or with invalid default value. |
| System.InvalidOperationException | QuikGraph.Serialization.XmlConstants.GraphMLTag or QuikGraph.Serialization.XmlConstants.GraphTag not found. |
| System.InvalidOperationException | Failure while reading elements from GraphML. |
| System.NotSupportedException | Deserializing graph with unsupported property type. |
DeserializeFromGraphML<TVertex, TEdge, TGraph>(TGraph, XmlReader, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
Deserializes from XML reader (GraphML graph) into the given graph.
Declaration
public static void DeserializeFromGraphML<TVertex, TEdge, TGraph>(this TGraph graph, XmlReader reader, IdentifiableVertexFactory<TVertex> vertexFactory, IdentifiableEdgeFactory<TVertex, TEdge> edgeFactory)
where TEdge : IEdge<TVertex> where TGraph : IMutableVertexAndEdgeSet<TVertex, TEdge>
Parameters
| Type | Name | Description |
|---|---|---|
| TGraph | graph | Graph instance to fill. |
| System.Xml.XmlReader | reader | The XML reader. |
| IdentifiableVertexFactory<TVertex> | vertexFactory | Vertex factory method. |
| IdentifiableEdgeFactory<TVertex, TEdge> | edgeFactory | Edge factory method. |
Type Parameters
| Name | Description |
|---|---|
| TVertex | Vertex type. |
| TEdge | Edge type. |
| TGraph | Graph type. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
| System.ArgumentNullException |
|
| System.ArgumentNullException |
|
| System.ArgumentNullException |
|
| System.InvalidOperationException | Deserializing value on property without setter, or with invalid default value. |
| System.InvalidOperationException | QuikGraph.Serialization.XmlConstants.GraphMLTag or QuikGraph.Serialization.XmlConstants.GraphTag not found. |
| System.InvalidOperationException | Failure while reading elements from GraphML. |
| System.NotSupportedException | Deserializing graph with unsupported property type. |
SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, String)
Serializes the given graph into GraphML in a file at given filePath.
Declaration
public static void SerializeToGraphML<TVertex, TEdge, TGraph>(this TGraph graph, string filePath)
where TEdge : IEdge<TVertex> where TGraph : IEdgeListGraph<TVertex, TEdge>
Parameters
| Type | Name | Description |
|---|---|---|
| TGraph | graph | Graph instance to serialize. |
| System.String | filePath | Path to the file where serializing the graph. |
Type Parameters
| Name | Description |
|---|---|
| TVertex | Vertex type. |
| TEdge | Edge type. |
| TGraph | Graph type. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
| System.ArgumentException |
|
| System.InvalidOperationException | Failure while writing elements to GraphML. |
| System.NotSupportedException | Serializing value on property without getter, or with unsupported property type. |
SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, String, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>)
Serializes the given graph into GraphML in a file at given filePath.
Declaration
public static void SerializeToGraphML<TVertex, TEdge, TGraph>(this TGraph graph, string filePath, VertexIdentity<TVertex> vertexIdentity, EdgeIdentity<TVertex, TEdge> edgeIdentity)
where TEdge : IEdge<TVertex> where TGraph : IEdgeListGraph<TVertex, TEdge>
Parameters
| Type | Name | Description |
|---|---|---|
| TGraph | graph | Graph instance to serialize. |
| System.String | filePath | Path to the file where serializing the graph. |
| VertexIdentity<TVertex> | vertexIdentity | Vertex identity method. |
| EdgeIdentity<TVertex, TEdge> | edgeIdentity | Edge identity method. |
Type Parameters
| Name | Description |
|---|---|
| TVertex | Vertex type. |
| TEdge | Edge type. |
| TGraph | Graph type. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
| System.ArgumentNullException |
|
| System.ArgumentNullException |
|
| System.ArgumentException |
|
| System.InvalidOperationException | Failure while writing elements to GraphML. |
| System.NotSupportedException | Serializing value on property without getter, or with unsupported property type. |
SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, XmlWriter)
Serializes the given graph into GraphML in the given writer.
Declaration
public static void SerializeToGraphML<TVertex, TEdge, TGraph>(this TGraph graph, XmlWriter writer)
where TEdge : IEdge<TVertex> where TGraph : IEdgeListGraph<TVertex, TEdge>
Parameters
| Type | Name | Description |
|---|---|---|
| TGraph | graph | Graph instance to serialize. |
| System.Xml.XmlWriter | writer | The XML writer. |
Type Parameters
| Name | Description |
|---|---|
| TVertex | Vertex type. |
| TEdge | Edge type. |
| TGraph | Graph type. |
Exceptions
| Type | Condition |
|---|---|
| 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. |
SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, XmlWriter, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>)
Serializes the given graph into GraphML in the given writer.
Declaration
public static void SerializeToGraphML<TVertex, TEdge, TGraph>(this TGraph graph, XmlWriter writer, VertexIdentity<TVertex> vertexIdentity, EdgeIdentity<TVertex, TEdge> edgeIdentity)
where TEdge : IEdge<TVertex> where TGraph : IEdgeListGraph<TVertex, TEdge>
Parameters
| Type | Name | Description |
|---|---|---|
| TGraph | graph | Graph instance to serialize. |
| System.Xml.XmlWriter | writer | The XML writer. |
| VertexIdentity<TVertex> | vertexIdentity | Vertex identity method. |
| EdgeIdentity<TVertex, TEdge> | edgeIdentity | Edge identity method. |
Type Parameters
| Name | Description |
|---|---|
| TVertex | Vertex type. |
| TEdge | Edge type. |
| TGraph | Graph type. |
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. |