Show / Hide Table of Contents

Class GraphMLExtensions

Extensions to help serializing/deserializing graph to/from GraphML.

Inheritance
System.Object
GraphMLExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: QuikGraph.Serialization
Assembly: QuikGraph.Serialization.dll
Syntax
public static class GraphMLExtensions

Methods

| Improve this Doc View Source

DeserializeAndValidateFromGraphML<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

graph is null.

System.ArgumentNullException

reader is null.

System.ArgumentNullException

vertexFactory is null.

System.ArgumentNullException

edgeFactory is null.

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.

| Improve this Doc View Source

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

graph is null.

System.ArgumentNullException

reader is null.

System.ArgumentNullException

vertexFactory is null.

System.ArgumentNullException

edgeFactory is null.

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.

| Improve this Doc View Source

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

graph is null.

System.ArgumentNullException

vertexFactory is null.

System.ArgumentNullException

edgeFactory is null.

System.ArgumentException

filePath is null or empty.

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.

| Improve this Doc View Source

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

graph is null.

System.ArgumentNullException

reader is null.

System.ArgumentNullException

vertexFactory is null.

System.ArgumentNullException

edgeFactory is null.

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.

| Improve this Doc View Source

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

graph is null.

System.ArgumentException

filePath is null or empty.

System.InvalidOperationException

Failure while writing elements to GraphML.

System.NotSupportedException

Serializing value on property without getter, or with unsupported property type.

| Improve this Doc View Source

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

graph is null.

System.ArgumentNullException

vertexIdentity is null.

System.ArgumentNullException

edgeIdentity is null.

System.ArgumentException

filePath is null or empty.

System.InvalidOperationException

Failure while writing elements to GraphML.

System.NotSupportedException

Serializing value on property without getter, or with unsupported property type.

| Improve this Doc View Source

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

graph is null.

System.ArgumentNullException

writer is null.

System.InvalidOperationException

Failure while writing elements to GraphML.

System.NotSupportedException

Serializing value on property without getter, or with unsupported property type.

| Improve this Doc View Source

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

graph is null.

System.ArgumentNullException

writer is null.

System.ArgumentNullException

vertexIdentity is null.

System.ArgumentNullException

edgeIdentity is null.

System.InvalidOperationException

Failure while writing elements to GraphML.

System.NotSupportedException

Serializing value on property without getter, or with unsupported property type.

  • Improve this Doc
  • View Source
In This Article
Back to top QuikGraph