using System;
using System.Collections.Generic;
using System.Text;
using QuickGraph;
using QuickGraph.Algorithms;
using QuickGraph.Serialization;
using System.IO;
using QuickGraph.Graphviz;

using MyVertex = System.Int32;
using MyEdge = QuickGraph.Edge<System.Int32>;


namespace Generator
{
    class Generator
    {
        const int vertexCount = 100000;
        const int edgeCount = 100000;
        const string outFile = "output";

        static void Main(string[] args)
        {
            AdjacencyGraph<MyVertex, MyEdge> graph = new AdjacencyGraph<MyVertex, MyEdge>();
            int vertNum = 0;
            
            RandomGraphFactory.Create(graph, () => ++vertNum,
                (v1, v2) => new MyEdge(v1, v2),
                new Random(DateTime.Now.Millisecond),
                vertexCount, edgeCount, false);
            
            
            //.Net serialization
            using (var stream = File.Open(outFile + ".bin", FileMode.Create))
                graph.SerializeToBinary(stream);

            
            //Dot format
            GraphvizAlgorithm<MyVertex, MyEdge> graphviz = new GraphvizAlgorithm<MyVertex, MyEdge>
                (graph, outFile, QuickGraph.Graphviz.Dot.GraphvizImageType.PlainText);
            graphviz.Generate(new CustomDotEngine(), outFile);
        }
    }
}
