public void RandomDotFileTests()
        {
            int    line, column;
            string msg;

            string fileName = Path.Combine(this.TestContext.TestDir, "Out\\Dots\\fsm.dot");

            Drawing.Graph drawGraph = Parser.Parse(fileName, out line, out column, out msg);
            drawGraph.CreateGeometryGraph();
            GeometryGraph graph = drawGraph.GeometryGraph;

            GraphGenerator.SetRandomNodeShapes(graph, random);
            LayeredLayout layeredLayout = new LayeredLayout(graph, new SugiyamaLayoutSettings()
            {
                BrandesThreshold = 1
            });

            layeredLayout.Run();
            string[]   allFiles = Directory.GetFiles(Path.Combine(this.TestContext.TestDir, "Out\\Dots"), "*.dot");
            List <int> selected = new List <int>();

            for (int i = 0; i < 10; i++)
            {
                int next = random.Next(allFiles.Length);
                while (selected.Contains(next))
                {
                    next = random.Next(allFiles.Length);
                }
                selected.Add(next);
                WriteLine("Now handling dot file: " + allFiles[next]);
                drawGraph = Parser.Parse(allFiles[next], out line, out column, out msg);
                drawGraph.CreateGeometryGraph();
                graph = drawGraph.GeometryGraph;
                GraphGenerator.SetRandomNodeShapes(graph, random);

                LayerDirection direction = LayerDirection.None;
                switch (i % 4)
                {
                case 0:
                    direction = LayerDirection.TopToBottom;
                    break;

                case 1:
                    direction = LayerDirection.BottomToTop;
                    break;

                case 2:
                    direction = LayerDirection.LeftToRight;
                    break;

                case 3:
                    direction = LayerDirection.RightToLeft;
                    break;
                }
                LayoutAndValidate(graph, (SugiyamaLayoutSettings)drawGraph.LayoutAlgorithmSettings, direction);
            }
        }
        protected GeometryGraph LoadGraph(string geometryGraphFileName, out LayoutAlgorithmSettings settings)
        {
            if (string.IsNullOrEmpty(geometryGraphFileName))
            {
                throw new ArgumentNullException("geometryGraphFileName");
            }

            GeometryGraph graph = null;

            settings = null;
            if (geometryGraphFileName.EndsWith(".geom"))
            {
                graph = GeometryGraphReader.CreateFromFile(geometryGraphFileName, out settings);
                SetupPorts(graph);
            }
            else if (geometryGraphFileName.EndsWith(".dot"))
            {
                int           line;
                string        msg;
                int           col;
                Drawing.Graph drawingGraph = Parser.Parse(geometryGraphFileName, out line, out col, out msg);
                drawingGraph.CreateGeometryGraph();
                graph    = drawingGraph.GeometryGraph;
                settings = drawingGraph.CreateLayoutSettings();
                GraphGenerator.SetRandomNodeShapes(graph, new Random(1));
            }
            else
            {
                Assert.Fail("Unknown graph format for file: " + geometryGraphFileName);
            }

            TestContext.WriteLine("Loaded graph: {0} Nodes, {1} Edges", graph.Nodes.Count, graph.Edges.Count);
            return(graph);
        }