Ejemplo n.º 1
0
        public void RouteEdges_SmallGrid()
        {
            //DisplayGeometryGraph.SetShowFunctions();

            Random random = new Random(1);
            int    ntest  = 20;

            for (int i = 0; i < ntest; i++)
            {
                GeometryGraph graph = GraphGenerator.GenerateSquareLattice(20 + random.Next(20));
                AddRootCluster(graph);
                SetRandomNodeShapes(graph, random);
                int additionalEdges = random.Next(20);

                for (int j = 0; j < additionalEdges; j++)
                {
                    Node source = graph.Nodes[random.Next(graph.Nodes.Count)];
                    Node target = graph.Nodes[random.Next(graph.Nodes.Count)];
                    Edge edge   = GraphGenerator.CreateEdge(source, target);
                    graph.Edges.Add(edge);
                }

                Layout(graph, random);
                //DisplayGeometryGraph.ShowGraph(graph);

                RouteEdges(graph, 5 * random.NextDouble());
                //DisplayGeometryGraph.ShowGraph(graph);
            }
        }
        public void LatticeGraphTests()
        {
            GeometryGraph          graph    = GraphGenerator.GenerateSquareLattice(20);
            SugiyamaLayoutSettings settings = new SugiyamaLayoutSettings();

            GraphGenerator.SetRandomNodeShapes(graph, random);
            WriteLine("Trying Lattice Graph with Top to Down layer direction");
            LayoutAndValidate(graph, settings);
        }