Skip to content

.NET Serialization

Alexandre Rabérin edited this page May 12, 2020 · 1 revision

.NET Serialization

All graph data structure can be serialized using the .NET serialization mechanism. You can also use the SerializeToBinary extension methods.

Serializing graphs

var graph = ...; // Some graph
using (var stream = File.Open("graph.bin"))
{
    graph.SerializeToBinary(stream);
}

Deserializing graphs

AdjacencyGraph<TVertex,TEdge> graph; // Some graph
using (var stream = File.Open("graph.bin"))
{
    graph = stream.DeserializeFromBinary();
}
Clone this wiki locally