Esempio n. 1
0
        public static Graph Deserialize(Stream stream, GraphProfile profile)
        {
            long position1 = stream.Position;
            long num1      = 1;
            int  num2      = stream.ReadByte();

            if (num2 != 1)
            {
                throw new Exception(string.Format("Cannot deserialize graph: Invalid version #: {0}.", (object)num2));
            }
            byte[] buffer = new byte[8];
            stream.Read(buffer, 0, 8);
            long num3    = num1 + 8L;
            long int64_1 = BitConverter.ToInt64(buffer, 0);

            stream.Read(buffer, 0, 8);
            long num4    = num3 + 8L;
            long int64_2 = BitConverter.ToInt64(buffer, 0);

            stream.Read(buffer, 0, 4);
            long num5    = num4 + 4L;
            int  int32_1 = BitConverter.ToInt32(buffer, 0);

            stream.Read(buffer, 0, 4);
            long             num6    = num5 + 4L;
            int              int32_2 = BitConverter.ToInt32(buffer, 0);
            ArrayBase <uint> vertices;
            ArrayBase <uint> edges;
            long             num7;

            if (profile == null)
            {
                vertices = (ArrayBase <uint>) new MemoryArray <uint>(int64_1 * (long)int32_1);
                vertices.CopyFrom(stream);
                long num8 = num6 + int64_1 * (long)int32_1 * 4L;
                edges = (ArrayBase <uint>) new MemoryArray <uint>(int64_2 * (long)int32_2);
                edges.CopyFrom(stream);
                num7 = num8 + int64_2 * (long)int32_2 * 4L;
            }
            else
            {
                long position2 = stream.Position;
                vertices = (ArrayBase <uint>) new Array <uint>(((MemoryMap) new MemoryMapStream((Stream) new CappedStream(stream, position2, int64_1 * (long)int32_1 * 4L))).CreateUInt32(int64_1 * (long)int32_1), profile.VertexProfile);
                long num8 = num6 + int64_1 * (long)int32_1 * 4L;
                edges = (ArrayBase <uint>) new Array <uint>(((MemoryMap) new MemoryMapStream((Stream) new CappedStream(stream, position2 + int64_1 * (long)int32_1 * 4L, int64_2 * (long)int32_2 * 4L))).CreateUInt32(int64_2 * (long)int32_2), profile.EdgeProfile);
                num7  = num8 + int64_2 * (long)int32_2 * 4L;
            }
            stream.Seek(position1 + num7, SeekOrigin.Begin);
            return(new Graph(int32_2 - 4, vertices, edges));
        }
Esempio n. 2
0
 public Graph(MemoryMap map, GraphProfile profile, int edgeDataSize, long estimatedSize)
 {
     this._edgeDataSize = edgeDataSize;
     this._edgeSize     = 4 + edgeDataSize;
     this._vertices     = (ArrayBase <uint>) new Array <uint>(map, estimatedSize, profile.VertexProfile);
     for (int index = 0; (long)index < this._vertices.Length; ++index)
     {
         this._vertices[(long)index] = 4294967294U;
     }
     this._edges = (ArrayBase <uint>) new Array <uint>(map, estimatedSize * 3L * (long)this._edgeSize, profile.EdgeProfile);
     for (int index = 0; (long)index < this._edges.Length; ++index)
     {
         this._edges[(long)index] = uint.MaxValue;
     }
 }
Esempio n. 3
0
        static GraphProfile()
        {
            GraphProfile graphProfile = new GraphProfile();

            graphProfile.VertexProfile = (ArrayProfile)ArrayProfile.Aggressive8;
            ArrayProfile arrayProfile = new ArrayProfile();
            int          num1         = 1024;

            arrayProfile.BufferSize = num1;
            int num2 = 16;

            arrayProfile.CacheSize    = num2;
            graphProfile.EdgeProfile  = arrayProfile;
            GraphProfile.Aggressive24 = graphProfile;
        }