/// <summary> /// Serializes this graph router data source to the given stream. /// </summary> /// <param name="stream"></param> /// <param name="edgeDataSize"></param> /// <param name="mapFrom"></param> /// <param name="mapTo"></param> /// <returns></returns> public override long Serialize(System.IO.Stream stream, int edgeDataSize, MappedHugeArray <TEdgeData, uint> .MapFrom mapFrom, MappedHugeArray <TEdgeData, uint> .MapTo mapTo) { // make room for size of graph. long position = 0; stream.Seek(8, System.IO.SeekOrigin.Begin); position = position + 8; // first serialize all graph-data. position = position + _graph.Serialize(new LimitedStream(stream), edgeDataSize, mapFrom, mapTo); // write size of graph. stream.Seek(0, System.IO.SeekOrigin.Begin); stream.Write(BitConverter.GetBytes(position), 0, 8); stream.Seek(position, System.IO.SeekOrigin.Begin); // serialize tags. var tagsSize = _tagsIndex.Serialize(new LimitedStream(stream)); position = position + tagsSize; return(position); }