public Form1()
        {
#if DEBUG
            DisplayGeometryGraph.SetShowFunctions();
#endif
            graphEditor = new GraphEditor();
            InitializeComponent();
            graphEditor.AddNodeType("Ellipse", Shape.Ellipse, Color.Transparent, Color.Black, 10, "user data",
                                    "New Node");
            graphEditor.AddNodeType("Square", Shape.Box, Color.Transparent, Color.Black, 6, "user data", "");
            graphEditor.AddNodeType("Double Circle", Shape.DoubleCircle, Color.Transparent, Color.Black, 6, "user data",
                                    "New Node");
            graphEditor.AddNodeType("Diamond", Shape.Diamond, Color.Transparent, Color.Black, 6, "user data", "New Node");
            graphEditor.Viewer.NeedToCalculateLayout = true;
            CreateGraph();
            graphEditor.Viewer.NeedToCalculateLayout = false;
            SuspendLayout();
            helpButton.BringToFront();
            graphEditor.Viewer.LayoutAlgorithmSettingsButtonVisible = false;
            ResumeLayout();

            helpButton.Click += helpButton_Click;
#if DEBUG
            //   Microsoft.Msagl.GraphViewerGdi.DisplayGeometryGraph.SetShowFunctions();
#endif
        }
Esempio n. 2
0
        void CreatClusteredLayout()
        {
            FastIncrementalLayoutSettings settings;
            Graph drawingGraph  = CtreateDrawingGraph(out settings);
            var   geometryGraph = drawingGraph.GeometryGraph;

            FillClustersAndSettings(settings, geometryGraph);
            (new InitialLayout(geometryGraph, settings)).Run();
            geometryGraph.UpdateBoundingBox();



#if DEBUG
            DisplayGeometryGraph.BindGeomGraphToDrawingGraph(drawingGraph, geometryGraph);
            drawingGraph.DebugCurves = GetClusterBounds(geometryGraph.RootCluster.Clusters).ToArray();
#endif

            //LayoutAlgorithmSettings.Show(geometryGraph.Nodes.Select(node => node.BoundaryCurve).ToArray());

            var splineRouter = new SplineRouter(geometryGraph, settings.NodeSeparation / 6, settings.NodeSeparation / 6, Math.PI / 6);
            splineRouter.Run();

            gViewer.NeedToCalculateLayout = false;
            gViewer.Graph = drawingGraph;
            gViewer.ZoomF = 1;
        }
        public void Clusterabc()
        {
#if TEST_MSAGL
            DisplayGeometryGraph.SetShowFunctions();
#endif
            var geometryGraph = new GeometryGraph();
            geometryGraph.RootCluster = new Cluster();
            var a = new Node();
            a.BoundaryCurve = CurveFactory.CreateCircle(20, new Point());
            var b = new Node();
            b.BoundaryCurve = CurveFactory.CreateCircle(20, new Point());
            var c = new Node();
            c.BoundaryCurve = CurveFactory.CreateCircle(20, new Point());


            geometryGraph.RootCluster.AddNode(a);
            geometryGraph.RootCluster.AddNode(b);
            geometryGraph.RootCluster.AddNode(c);
            b.AddInEdge(new Edge(a, b));
            c.AddInEdge(new Edge(a, c));
            var mdsLayoutSettings = new MdsLayoutSettings {
                RemoveOverlaps = true, NodeSeparation = 10
            };
            var mdsLayout = new MdsGraphLayout(mdsLayoutSettings, geometryGraph);
            mdsLayout.Run();
            var splineRouter = new SplineRouter(geometryGraph, geometryGraph.Edges, 2,
                                                3,
                                                Math.PI / 6, null);
            splineRouter.Run();

#if TEST_MSAGL
            DisplayGeometryGraph.ShowGraph(geometryGraph);
#endif
        }
        private static void CheckEdgesForOverlapWithNodes(double tightPadding, GeometryGraph graph)
        {
#if TEST_MSAGL
            if (!DontShowTheDebugViewer())
            {
                DisplayGeometryGraph.SetShowFunctions();
            }
#endif
            foreach (var e in graph.Edges.Where(e => !MultiEdge(e)))//avoid checking multi-edges since they routed as bundles and can slightly go over the nodes
            {
                Assert.IsNotNull(e.EdgeGeometry, "EdgeGeometry is null");
                Assert.IsNotNull(e.EdgeGeometry.Curve, "EdgeGeometry.Curve is null");
                foreach (var v in graph.Nodes)
                {
                    if (v == e.Source || v == e.Target)
                    {
                        continue;
                    }
                    var  box      = v.BoundingBox;
                    var  poly     = InteractiveObstacleCalculator.CreatePaddedPolyline(Curve.PolylineAroundClosedCurve(v.BoundaryCurve), tightPadding / 2);
                    bool overlaps = CurveOverlapsBox(e.EdgeGeometry.Curve, ref box, poly);
#if TEST_MSAGL
                    //uncomment to see the graph and the overlaps
                    if (overlaps && !DontShowTheDebugViewer())
                    {
                        LayoutAlgorithmSettings.ShowGraph(graph);
                        LayoutAlgorithmSettings.Show(poly, e.Curve);
                    }
#endif
                    Assert.IsFalse(overlaps);
                }
            }
        }
Esempio n. 5
0
        public static void RsmContent()
        {
            const int ntest  = 7000;
            int       iStart = 1;

            for (int multiplier = 1; multiplier < 12; multiplier++)
            {
                System.Diagnostics.Debug.WriteLine("multiplier " + multiplier);
#if TEST_MSAGL && TEST_MSAGL
                DisplayGeometryGraph.SetShowFunctions();
#endif
                for (int i = iStart; i < ntest; i++)
                {
                    Random        random = new Random(i);
                    GeometryGraph graph  = GenerateGraphWithGroups(random, multiplier);
                    SetRandomNodeShapes(graph, random);
                    Layout(graph, random);
                    // DisplayGeometryGraph.ShowGraph(graph);

                    double edgeSeparation = 5 * random.NextDouble();
                    System.Diagnostics.Debug.WriteLine("i={0} es={1}", i, edgeSeparation);
                    GeometryGraphWriter.Write(graph, "c:\\tmp\\graph");
                    RouteEdges(graph, edgeSeparation);
                    //DisplayGeometryGraph.ShowGraph(graph);

                    //TODO: try to move it
                }
            }
        }
        private static void Main(string[] args)
        {
#if DEBUG && !SILVERLIGHT
            DisplayGeometryGraph.SetShowFunctions();
            // ProximityOverlapRemoval.DebugMode = true;
#endif
            var argsParser = new ArgsParser.ArgsParser(args);
            argsParser.AddOptionWithAfterStringWithHelp("-graphs", "number of graphs with circles to generate");
            argsParser.AddOptionWithAfterStringWithHelp("-circles", "number of circles per graph to  generate");
            argsParser.AddOptionWithAfterStringWithHelp("-fcrc", "number of circles per graph to  generate");
            argsParser.AddOptionWithAfterStringWithHelp("-triangles", "number of triangles per graph to  generate");
            argsParser.AddOptionWithAfterStringWithHelp("-nodes_per_circle", "number of nodes per circle");
            argsParser.AddOptionWithAfterStringWithHelp("-box_width", "the initial width of the rectangle to layout the nodes");
            argsParser.AddOptionWithAfterStringWithHelp("-test_dir", "the directory of test files");
            argsParser.AddOptionWithAfterStringWithHelp("-ds", "generate a number of dense spots");
            argsParser.AddAllowedOptionWithHelpString("-dup", "duplicate with color");
            argsParser.AddAllowedOptionWithHelpString("-dot", "load real dot files");


            if (!argsParser.Parse())
            {
                Console.WriteLine(argsParser.ErrorMessage);
                Console.WriteLine(argsParser.UsageString());
                return;
            }
            var program = new Program(argsParser);
            program.Run();
        }
Esempio n. 7
0
        protected override void OnStartup(StartupEventArgs e)
        {
#if DEBUG
            DisplayGeometryGraph.SetShowFunctions();
#endif
            args = e.Args;
            base.OnStartup(e);
        }
        public Form1()
        {
#if DEBUG
            DisplayGeometryGraph.SetShowFunctions();
#endif

            InitializeComponent();
            SetGraph();
        }
        protected override void OnStartup(StartupEventArgs e)
        {
#if DEBUG
            DisplayGeometryGraph.SetShowFunctions();
#endif

            // debug
            //Test1.RunTest9();

            _appWindow = new AppWindow
            {
                Title       = "Graphmaps browser",
                Width       = SystemParameters.WorkArea.Width - 300,
                Height      = SystemParameters.WorkArea.Height,
                GraphViewer = _graphViewer,
                //Content = dockPanel,
                //WindowStartupLocation = WindowStartupLocation.CenterScreen,
                //WindowState = WindowState.Normal
            };

            _dockPanel        = _appWindow.GetMainDockPanel();
            _graphViewerPanel = _appWindow.GetGraphViewerPanel();
            _statusTextBox    = _appWindow.GetStatusTextBox();

            //SetupToolbar();
            SetAppCommands();

            //graphViewerPanel.ClipToBounds = true;
            //dockPanel.Children.Add(toolBar);
            //SetUpStatusBar();

            //dockPanel.LastChildFill = true;
            //dockPanel.Children.Add(graphViewerPanel);
            _graphViewer.BindToPanel(_graphViewerPanel);
            _dockPanel.Loaded += GraphViewerLoaded;
            _argsParser        = SetArgsParser(Args);
            //graphViewer.MainPanel.MouseLeftButtonUp += TestApi;
            TrySettingGraphViewerLargeLayoutThresholdAndSomeOtherLgSettings();
            if (_argsParser.OptionIsUsed(ExitAfterLgLayoutOption))
            {
                _graphViewer.DefaultLargeLayoutSettings.ExitAfterInit = true;
            }

            _graphViewer.ViewChangeEvent += GraphViewerViewChangeEvent;
            _graphViewer.ObjectUnderMouseCursorChanged += GvObjectUnderMouseCursorChanged;
            _graphViewer.MouseDown += GraphViewerMouseDown;
            _graphViewer.MouseMove += GraphViewerMouseMove;


            _graphViewer.GraphChanged += graphViewer_GraphChanged;
            //graphViewer.LayoutEditingEnabled = false;
            OnStartupTextBox(e);
            base.OnStartup(e);
            _appWindow.Show();
//SetUpAndShowSideWindow();
        }
        public void BundlingBug1GeomGraph()
        {
#if TEST_MSAGL && TEST_MSAGL
            DisplayGeometryGraph.SetShowFunctions();
#endif
            var graph    = GeometryGraphReader.CreateFromFile(GetGeomGraphFileName("bug1.msagl.geom"));
            var settings = new BundlingSettings();
            var router   = new SplineRouter(graph, 0.1, 0.75, Math.PI / 6, settings);
            router.Run();
        }
Esempio n. 11
0
        public Form1()
        {
#if DEBUG
            DisplayGeometryGraph.SetShowFunctions();
#endif
            InitializeComponent();
            SuspendLayout();
            Controls.Add(gViewer);
            gViewer.Dock = DockStyle.Fill;
            ResumeLayout();
            CreatClusteredLayout();
        }
Esempio n. 12
0
        static void Main(string[] args)
        {
#if DEBUG
            if (args.Length < 1)
            {
                Console.WriteLine("no file name was given");
                return;
            }
            var debugCurves = GetDebugCurves(args[0]);
            if (null != debugCurves)
            {
                DisplayGeometryGraph.ShowDebugCurvesEnumerationOnForm(debugCurves, new Form1());
            }
        }
Esempio n. 13
0
        static void Main(string[] args)
        {
#if TEST_MSAGL
            if (args.Length < 1)
            {
                System.Diagnostics.Debug.WriteLine("no file name was given");
                return;
            }
            var debugCurves = GetDebugCurves(args[0]);
            if (null != debugCurves)
            {
                DisplayGeometryGraph.ShowDebugCurvesEnumerationOnForm(debugCurves, new Form1());
            }
        }
Esempio n. 14
0
        static void Triangulation(bool reverseX)
        {
#if TEST_MSAGL
            DisplayGeometryGraph.SetShowFunctions();
#endif
            int r = reverseX ? -1 : 1;
            IEnumerable <Point> points = Points().Select(p => new Point(r * p.X, p.Y));

            var poly = (Polyline)RussiaPolyline.GetTestPolyline().ScaleFromOrigin(1, 1);
            var cdt  = new Cdt(null, new[] { poly }, null);
            cdt.Run();
#if TEST_MSAGL
            CdtSweeper.ShowFront(cdt.GetTriangles(), null, null, null);
#endif
        }
        static void Main(string[] args)
        {
#if TEST_MSAGL
            DisplayGeometryGraph.SetShowFunctions();
#endif
            ArgsParser.ArgsParser argsParser = SetArgsParser(args);
            if (argsParser.OptionIsUsed("-help"))
            {
                Console.WriteLine(argsParser.UsageString());
                Environment.Exit(0);
            }

            bundling = argsParser.OptionIsUsed(BundlingOption);

            var gviewer = new GViewer();
            if (argsParser.OptionIsUsed(FdOption))
            {
                gviewer.CurrentLayoutMethod = LayoutMethod.IcrementalLayout;
            }
            Form form = CreateForm(null, gviewer);
            if (argsParser.OptionIsUsed(AsyncLayoutOption))
            {
                gviewer.AsyncLayout = true;
            }

            string fileName = argsParser.GetStringOptionValue(FileOption);
            if (fileName != null)
            {
                string ext = Path.GetExtension(fileName);
                if (ext != null)
                {
                    ext = ext.ToLower();
                    if (ext == ".dot")
                    {
                        ProcessDotFile(gviewer, argsParser, fileName);
                    }
                }
                else
                {
                    Console.WriteLine("do not know how to process {0}", fileName);
                    Environment.Exit(1);
                }
            }
            if (!argsParser.OptionIsUsed(QuietOption))
            {
                Application.Run(form);
            }
        }
Esempio n. 16
0
        public Form1()
        {
#if DEBUG
            DisplayGeometryGraph.SetShowFunctions();
#endif
            InitializeComponent();
            creek     = Image.FromFile("Creek.jpg");
            leaves    = Image.FromFile("Autumn Leaves.jpg");
            tree      = Image.FromFile("tree.jpg");
            waterfall = Image.FromFile("waterfall.jpg");
            SuspendLayout();
            this.Controls.Add(viewer);
            viewer.Dock = DockStyle.Fill;
            ResumeLayout();
            viewer.LayoutAlgorithmSettingsButtonVisible = false;
            InitGraph();
        }
Esempio n. 17
0
        Dot2SvgMain(string[] args)
        {
#if DEBUG
            DisplayGeometryGraph.SetShowFunctions();
#endif
            argsParser = new ArgsParser.ArgsParser(args);
            argsParser.AddOptionWithAfterString(FileOption);
            argsParser.AddAllowedOption(MsaglOutputOption);
            argsParser.AddAllowedOption(PrintOutOption);
            argsParser.AddAllowedOption(HelpOption);
            argsParser.AddOptionWithAfterString(PrecisionOption);
            argsParser.AddAllowedOption(VssParserOption);
            argsParser.AddAllowedOption(NoLabelsOption);
            argsParser.AddAllowedOption(PrintProcessedFileNameOption);
            argsParser.AddOptionWithAfterString(OutputDirOption);
            argsParser.AddAllowedOption(NoArrowheads);
            argsParser.AddAllowedOption(NoUrls);
        }
        private static void Main(string[] args)
        {
#if DEBUG && !SILVERLIGHT
            DisplayGeometryGraph.SetShowFunctions();
//                        ProximityOverlapRemoval.DebugMode = true;
#endif

            //          OverlapRemovalTestSuite.ComparisonSuite(@"C:\dev\GraphLayout\graphs\overlapSamples\debugOnly\", "DebugOnlyTestSuite1.csv", false);
            //          OverlapRemovalTestSuite.ComparisonSuite(@"C:\dev\GraphLayout\graphs\overlapSamples\", "ResultsOverlapRemovalTestSuite1.csv", false);
            //            OverlapRemovalTestSuite.ComparisonSuite(@"C:\dev\GraphLayout\graphs\overlapSamples\net50comp1\", "ResultsNet50comp1TestSuite1.csv", false);
            //          OverlapRemovalTestSuite.ComparisonSuite(@"C:\dev\GraphLayout\graphs\overlapSamples\large\", "ResultsLargeGraphsTestSuite1.csv", false);
            OverlapRemovalTestSuite.ComparisonSuite(
                @"C:\dev\GraphLayout\graphs\overlapSamples\prism-original-dataset\",
                "ResultsPrism-original-datasetTestSuite1.csv", false);


            //            Console.ReadLine();
            //            var rootGraph = DotLoader.LoadFile(@"C:\dev\GraphLayout\graphs\overlapSamples\root.dot");

            ////          var rootGraph = DotLoader.LoadFile(@"C:\dev\GraphLayout\graphs\overlapSamples\net50comp1\net50comp_1.gv.dot");
            ////          var rootGraph = DotLoader.LoadFile(@"C:\dev\GraphLayout\graphs\overlapSamples\badvoro.gv.dot");
            ////          var rootGraph = DotLoader.LoadFile(@"C:\dev\GraphLayout\graphs\large\twittercrawl-sfdp.dot");
            ////          var oldPositions = rootGraph.Nodes.Select(v => v.Center).ToList();
            ////          LayoutAlgorithmSettings.ShowGraph(rootGraph);
            //            ProximityOverlapRemoval prism=new ProximityOverlapRemoval(rootGraph);
            //            prism.Settings.WorkInInches = true;
            //            prism.Settings.StressSettings.ResidualTolerance = 0.06;
            //#if DEBUG
            //            ProximityOverlapRemoval.DebugMode = false;
            //#endif
            //            prism.RemoveOverlap();
            ////            var newPositions = rootGraph.Nodes.Select(v => v.Center).ToList();
            ////            var procrustes = Statistics.Statistics.ProcrustesStatistics(oldPositions, newPositions);
            ////            Console.WriteLine("ProcrustesStatistics: {0}",procrustes);
            //
            //#if DEBUG
            //
            //            LayoutAlgorithmSettings.ShowGraph(rootGraph);
            //#endif
            //            Console.ReadLine();
        }
Esempio n. 19
0
        static void Main()
        {
#if TEST
            DisplayGeometryGraph.SetShowFunctions();
#else
            System.Diagnostics.Debug.WriteLine("run the Debug version to see the edge routes");
#endif
            var graph = GeometryGraphReader.CreateFromFile("channel.msagl.geom");
            foreach (var edge in graph.Edges)
            {
                if (edge.SourcePort == null)
                {
                    edge.SourcePort = new FloatingPort(edge.Source.BoundaryCurve, edge.Source.Center);
                }
                if (edge.TargetPort == null)
                {
                    edge.TargetPort = new FloatingPort(edge.Target.BoundaryCurve, edge.Target.Center);
                }
            }

            DemoEdgeRouterHelper(graph);
        }
Esempio n. 20
0
        private static void ThreadThroughCdt()
        {
            FileStream stream     = File.Open("triangles2", FileMode.Open);
            var        bformatter = new BinaryFormatter();

            var trs   = (CdtTriangle[])bformatter.Deserialize(stream);
            var start = (Point)bformatter.Deserialize(stream);
            var end   = (Point)bformatter.Deserialize(stream);

            stream.Close();
#if TEST_MSAGL
            foreach (var t in FindStartTriangle(trs, start))
            {
                var ll = ThreadOnTriangle(start, end, t);
                foreach (var cdtTriangle in trs)
                {
                    AddTriangleToListOfDebugCurves(ll, cdtTriangle, 50, 1, "blue");
                }
                DisplayGeometryGraph.ShowDebugCurves(ll.ToArray());
            }
#endif
        }
Esempio n. 21
0
        public static void RsmContentFromDisc()
        {
            int ntest  = 10000;
            int iStart = 1; // 470;

#if TEST_MSAGL && TEST_MSAGL
            DisplayGeometryGraph.SetShowFunctions();
#endif
            var graph = GeometryGraphReader.CreateFromFile(@"c:\tmp\graph0.msagl.geom");

            for (int i = iStart; i < ntest; i++)
            {
                Random random = new Random(i);

                double edgeSeparation = 5 * random.NextDouble();
                System.Diagnostics.Debug.WriteLine("i={0} es={1}", i, edgeSeparation);
                RouteEdges(graph, edgeSeparation);
                // DisplayGeometryGraph.ShowGraph(graph);

                //TODO: try to move it
            }
        }
        void CreateGraph()
        {
            DisplayGeometryGraph.SetShowFunctions();
            Graph graph = new Graph();

            for (int i = 0; i < links.Count; i++)
            {
                graph.AddEdge(links[i].Start_node.Name, links[i].Final_node.Name).LabelText = links[i].Trans;
            }


            var subgraph = new Subgraph("Автомат");

            graph.RootSubgraph.AddSubgraph(subgraph);
            for (int i = 0; i < links.Count; i++)
            {
                subgraph.AddNode(graph.FindNode(links[i].Start_node.Name));
            }


            graph.Attr.LayerDirection = LayerDirection.LR;
            gViewer.Graph             = graph;
        }
Esempio n. 23
0
        Dot2SvgMain(string[] args)
        {
#if DEBUG
            DisplayGeometryGraph.SetShowFunctions();
#endif
            argsParser = new ArgsParser.ArgsParser(args);
            argsParser.AddAllowedOptionWithHelpString("-nolayout", "do not run layout if the geometry is there");
            argsParser.AddOptionWithAfterString(FileOption);
            argsParser.AddAllowedOption(MsaglOutputOption);
            argsParser.AddAllowedOption(PrintOutOption);
            argsParser.AddAllowedOption(HelpOption);
            argsParser.AddOptionWithAfterString(PrecisionOption);
            argsParser.AddAllowedOption(VssParserOption);
            argsParser.AddAllowedOption(NoLabelsOption);
            argsParser.AddAllowedOption(PrintProcessedFileNameOption);
            argsParser.AddOptionWithAfterString(OutputDirOption);
            argsParser.AddAllowedOption(NoArrowheads);
            argsParser.AddAllowedOption(NoUrls);
            argsParser.AddOptionWithAfterStringWithHelp("-orient", "one of options  TB, LR, BT, RL");
            argsParser.AddAllowedOptionWithHelpString("-bw", "black white colors in SVG");
            argsParser.AddAllowedOption("-noedges");
            argsParser.AddOptionWithAfterStringWithHelp("-scaleNodesBy", "scale node only if the geometry is given");
            argsParser.AddOptionWithAfterStringWithHelp("-nblw", "node boundary line width");
        }
Esempio n. 24
0
        static void TestGraphWithConstraints()
        {
            var graph = new GeometryGraph();

            var closed    = new Node(CreateEllipse(), "closed");
            var line      = new Node(CreateEllipse(), "line");
            var bezier    = new Node(CreateEllipse(), "bezier");
            var arc       = new Node(CreateEllipse(), "arc");
            var rectangle = new Node(CreateEllipse(), "rectangle");
            var ellipse   = new Node(CreateEllipse(), "ellipse");
            var polygon   = new Node(CreateEllipse(), "polygon");
            var shapes    = new Node(CreateEllipse(), "shapes");
            var open      = new Node(CreateEllipse(), "open");

            graph.Nodes.Add(closed);
            graph.Nodes.Add(line);
            graph.Nodes.Add(bezier);
            graph.Nodes.Add(arc);
            graph.Nodes.Add(rectangle);
            graph.Nodes.Add(ellipse);
            graph.Nodes.Add(polygon);
            graph.Nodes.Add(shapes);
            graph.Nodes.Add(open);

            var so = new Edge(shapes, open);
            var sc = new Edge(shapes, closed);
            var ol = new Edge(open, line);
            var ob = new Edge(open, bezier);
            var oa = new Edge(open, arc);
            var cr = new Edge(closed, rectangle);
            var ce = new Edge(closed, ellipse);
            var cp = new Edge(closed, polygon);

            graph.Edges.Add(so);
            graph.Edges.Add(sc);
            graph.Edges.Add(ol);
            graph.Edges.Add(ob);
            graph.Edges.Add(oa);
            graph.Edges.Add(cr);
            graph.Edges.Add(ce);
            graph.Edges.Add(cp);

            var settings = new SugiyamaLayoutSettings();

            settings.AddUpDownVerticalConstraint(closed, ellipse);
            settings.AddUpDownVerticalConstraint(open, bezier);
            settings.AddUpDownConstraint(closed, open);
            settings.AddSameLayerNeighbors(polygon, open);
            settings.AddLeftRightConstraint(closed, open);
            settings.AddLeftRightConstraint(open, closed);

            ////To verify 444585, just turn on this following commented line
            settings.AddLeftRightConstraint(ellipse, rectangle);
            settings.AddLeftRightConstraint(ellipse, bezier);

            var layeredLayout = new LayeredLayout(graph, settings);

            layeredLayout.Run();
#if TEST_MSAGL
            DisplayGeometryGraph.ShowGraph(graph);
#endif
        }
Esempio n. 25
0
        static void Main(string[] args)
        {
#if TEST_MSAGL
            DisplayGeometryGraph.SetShowFunctions();
#endif
            ArgsParser.ArgsParser argsParser = SetArgsParser(args);
            if (argsParser.OptionIsUsed("-help"))
            {
                Console.WriteLine(argsParser.UsageString());
                Environment.Exit(0);
            }
            if (argsParser.OptionIsUsed(PolygonDistanceTestOption))
            {
                TestPolygonDistance();
            }
            else if (argsParser.OptionIsUsed(TestCdtThreaderOption))
            {
                TestCdtThreader();
            }
            else if (argsParser.OptionIsUsed(RandomBundlingTest))
            {
                RandomBundlingTests.RsmContent();
            }


            bundling = argsParser.OptionIsUsed(BundlingOption);

            var gviewer = new GViewer();
            gviewer.MouseMove += Draw.GviewerMouseMove;
            if (argsParser.OptionIsUsed(FdOption))
            {
                TestFD();
                gviewer.CurrentLayoutMethod = LayoutMethod.IcrementalLayout;
            }
            Form form = CreateForm(null, gviewer);
            if (argsParser.OptionIsUsed(AsyncLayoutOption))
            {
                gviewer.AsyncLayout = true;
            }

            string listOfFilesFile = argsParser.GetStringOptionValue(ListOfFilesOption);
            if (listOfFilesFile != null)
            {
                ProcessListOfFiles(listOfFilesFile, argsParser);
                return;
            }
            string fileName = argsParser.GetStringOptionValue(FileOption);
            string ext      = Path.GetExtension(fileName);
            if (ext != null)
            {
                ext = ext.ToLower();
                if (ext == ".dot")
                {
                    ProcessDotFile(gviewer, argsParser, fileName);
                }
                else
                {
                    if (ext == ".geom")
                    {
                        GeometryGraph geometryGraph = GeometryGraphReader.CreateFromFile(fileName);
                        geometryGraph.Margins = 10;

                        FixHookPorts(geometryGraph);
                        // if (argsParser.OptionIsUsed(BundlingOption)) {
                        for (int i = 0; i < 1; i++)
                        {
#if TEST_MSAGL
                            /*DisplayGeometryGraph.ShowGraph(geometryGraph);
                             *  var l = new List<DebugCurve>(); l.AddRange(geometryGraph.Nodes.Select(n=>new DebugCurve(100,1,"black",n.BoundaryCurve)));
                             *  l.AddRange(geometryGraph.Edges.Select(e=>new DebugCurve(100,1,"black", new LineSegment(e.Source.Center,e.Target.Center))));
                             *  foreach (var cl in geometryGraph.RootCluster.AllClustersDepthFirst()) {
                             *      l.Add(new DebugCurve(100,2,"blue",cl.BoundaryCurve));
                             *      foreach (var node in cl.Nodes)
                             *          l.Add(new DebugCurve(100, 2, "brown", node.BoundaryCurve));
                             *
                             *      foreach (var e in cl.Edges)
                             *          l.Add(new DebugCurve(100, 2, "pink", new LineSegment(e.Source.Center, e.Target.Center)));
                             *
                             *  }
                             *
                             *  DisplayGeometryGraph.ShowDebugCurves(l.ToArray());*/
#endif
                            BundlingSettings bs = GetBundlingSettings(argsParser);

                            double loosePadding;
                            double tightPadding = GetPaddings(argsParser, out loosePadding);
                            if (argsParser.OptionIsUsed(MdsOption))
                            {
                                var mdsLayoutSettings = new MdsLayoutSettings {
                                    RemoveOverlaps = true, NodeSeparation = loosePadding * 3
                                };
                                var mdsLayout = new MdsGraphLayout(mdsLayoutSettings, geometryGraph);
                                mdsLayout.Run();
                            }
                            else
                            {
                                if (argsParser.OptionIsUsed(FdOption))
                                {
                                    var settings = new FastIncrementalLayoutSettings {
                                        AvoidOverlaps = true
                                    };
                                    (new InitialLayout(geometryGraph, settings)).Run();
                                }
                            }
                            var splineRouter = new SplineRouter(geometryGraph, geometryGraph.Edges, tightPadding,
                                                                loosePadding,
                                                                Math.PI / 6, bs);
                            splineRouter.Run();
                        }
#if TEST_MSAGL
                        DisplayGeometryGraph.ShowGraph(geometryGraph);
#endif
                        return;
                    }
                    else
                    {
                        if (ext == ".msagl")
                        {
                            Graph graph = Graph.Read(fileName);
                            //           DisplayGeometryGraph.ShowGraph(graph.GeometryGraph);
                            if (graph != null)
                            {
                                if (argsParser.OptionIsUsed(BundlingOption))
                                {
                                    BundlingSettings bs = GetBundlingSettings(argsParser);

                                    double loosePadding;
                                    double tightPadding = GetPaddings(argsParser, out loosePadding);
                                    var    br           = new SplineRouter(graph.GeometryGraph, tightPadding, loosePadding, Math.PI / 6,
                                                                           bs);
                                    br.Run();
                                    //                 DisplayGeometryGraph.ShowGraph(graph.GeometryGraph);
                                }
                            }
                            gviewer.NeedToCalculateLayout = false;
                            gviewer.Graph = graph;
                            gviewer.NeedToCalculateLayout = true;
                        }
                    }
                }
            }
            else if (argsParser.OptionIsUsed(TestCdtOption))
            {
                Triangulation(argsParser.OptionIsUsed(ReverseXOption));
                Environment.Exit(0);
            }
            else if (argsParser.OptionIsUsed(TestCdtOption0))
            {
                TestTriangulationOnSmallGraph(argsParser);
                Environment.Exit(0);
            }
            else if (argsParser.OptionIsUsed(TestCdtOption2))
            {
                TestTriangulationOnPolys();
                Environment.Exit(0);
            }
            else if (argsParser.OptionIsUsed(TestCdtOption1))
            {
                ThreadThroughCdt();
                Environment.Exit(0);
            }
            else if (argsParser.OptionIsUsed(ConstraintsTestOption))
            {
                TestGraphWithConstraints();
            }
            if (!argsParser.OptionIsUsed(QuietOption))
            {
                Application.Run(form);
            }
        }
Esempio n. 26
0
        void CreateGraphClustersBig(bool horizontal)
        {
            Graph graph = new Graph("clusters big");

            void addCluster(string clusterId, params string[] nodeIds)
            {
                if (nodeIds.Length == 0)
                {
                    nodeIds = new string[] { clusterId }
                }
                ;
                var cluster = new Subgraph(clusterId);

                foreach (var nodeId in nodeIds)
                {
                    var node = new Node(clusterId + "." + nodeId);
                    node.LabelText = nodeId;
                    graph.AddNode(node);
                    cluster.AddNode(node);
                }
                if (horizontal)
                {
                    cluster.Attr.ClusterLabelMargin = Microsoft.Msagl.Core.Layout.LgNodeInfo.LabelPlacement.Right;
                }
                graph.RootSubgraph.AddSubgraph(cluster);
            }

            addCluster("Arabinose");
            addCluster("Arabinose_control");
            addCluster("Arabinose_growth");
            addCluster("Auto");
            addCluster("Auto_control");
            addCluster("Auto_growth");
            addCluster("Degrader");
            addCluster("Degrader_control");
            addCluster("Degrader_growth");
            addCluster("Receivers", "Receiver0", "Receiver1", "Receiver2", "Receiver3");
            addCluster("Receivers_control", "Receiver0_control", "Receiver1_control", "Receiver2_control", "Receiver3_control");
            addCluster("Receivers_growth", "Receiver0_growth", "Receiver1_growth", "Receiver2_growth", "Receiver3_growth");
            addCluster("Relays", "Relay1", "Relay2");
            addCluster("Relays_control", "Relay1_control", "Relay2_control");
            addCluster("Relays_growth", "Relay1_growth", "Relay2_growth");
            addCluster("Standard");
            addCluster("Standard_control");
            addCluster("Standard_growth");

            void addEdge(string sourceCluster, string sourceNode, string targetCluster, string targetNode)
            {
                graph.AddEdge(sourceNode == null ? sourceCluster : (sourceCluster + "." + sourceNode), targetNode == null ? targetCluster : (targetCluster + "." + targetNode));
            }

            addEdge("Arabinose", "Arabinose", "Degrader", "Degrader");
            addEdge("Arabinose_control", "Arabinose_control", "Arabinose", "Arabinose");
            addEdge("Arabinose_control", "Arabinose_control", "Degrader_control", "Degrader_control");
            addEdge("Arabinose_growth", "Arabinose_growth", "Arabinose_control", "Arabinose_control");
            addEdge("Auto", null, "Standard", null);
            addEdge("Auto_control", "Auto_control", "Auto", "Auto");
            addEdge("Auto_control", null, "Standard_control", null);
            addEdge("Auto_growth", "Auto_growth", "Auto_control", "Auto_control");
            addEdge("Degrader_control", "Degrader_control", "Degrader", "Degrader");
            addEdge("Degrader_growth", "Degrader_growth", "Degrader_control", "Degrader_control");
            addEdge("Receivers", null, "Relays", null);
            addEdge("Receivers_control", null, "Relays_control", null);
            addEdge("Receivers_control", "Receiver0_control", "Receivers", "Receiver0");
            addEdge("Receivers_control", "Receiver1_control", "Receivers", "Receiver1");
            addEdge("Receivers_control", "Receiver2_control", "Receivers", "Receiver2");
            addEdge("Receivers_control", "Receiver3_control", "Receivers", "Receiver3");
            addEdge("Receivers_growth", "Receiver0_growth", "Receivers_control", "Receiver0_control");
            addEdge("Receivers_growth", "Receiver1_growth", "Receivers_control", "Receiver1_control");
            addEdge("Receivers_growth", "Receiver2_growth", "Receivers_control", "Receiver2_control");
            addEdge("Receivers_growth", "Receiver3_growth", "Receivers_control", "Receiver3_control");
            addEdge("Relays", null, "Degrader", null);
            addEdge("Relays_control", "Relay1_control", "Relays", "Relay1");
            addEdge("Relays_control", "Relay2_control", "Relays", "Relay2");
            addEdge("Relays_growth", "Relay1_growth", "Relays_control", "Relay1_control");
            addEdge("Relays_growth", "Relay2_growth", "Relays_control", "Relay2_control");
            addEdge("Standard", null, "Receivers", null);
            addEdge("Standard_control", null, "Receivers_control", null);
            addEdge("Standard_control", "Standard_control", "Standard", "Standard");
            addEdge("Standard_growth", "Standard_growth", "Standard_control", "Standard_control");

            if (horizontal)
            {
                (graph.LayoutAlgorithmSettings as SugiyamaLayoutSettings).Transformation = PlaneTransformation.Rotation(Math.PI / 2.0);
            }
            gViewer.Graph = graph;
            this.propertyGrid1.SelectedObject = graph;
        }

        void CreateGraph()
        {
#if TEST_MSAGL
            DisplayGeometryGraph.SetShowFunctions();
#endif
            //Graph graph = new Graph();
            //graph.AddEdge("47", "58");
            //graph.AddEdge("70", "71");



            //var subgraph = new Subgraph("subgraph1");
            //graph.RootSubgraph.AddSubgraph(subgraph);
            //subgraph.AddNode(graph.FindNode("47"));
            //subgraph.AddNode(graph.FindNode("58"));

            //var subgraph2 = new Subgraph("subgraph2");
            //subgraph2.Attr.Color = Color.Black;
            //subgraph2.Attr.FillColor = Color.Yellow;
            //subgraph2.AddNode(graph.FindNode("70"));
            //subgraph2.AddNode(graph.FindNode("71"));
            //subgraph.AddSubgraph(subgraph2);
            //graph.AddEdge("58", subgraph2.Id);
            //graph.Attr.LayerDirection = LayerDirection.LR;
            //gViewer.Graph = graph;
            Graph graph = new Graph("graph");
            //graph.LayoutAlgorithmSettings=new MdsLayoutSettings();
            gViewer.BackColor = System.Drawing.Color.FromArgb(10, System.Drawing.Color.Red);

            /*
             * 4->5
             * 5->7
             * 7->8
             * 8->22
             * 22->24
             */

            graph.AddEdge("1", "2");
            graph.AddEdge("1", "3");
            var e = graph.AddEdge("4", "5");
            e.Attr.Color      = Color.Red;
            e.Attr.LineWidth *= 2;
            graph.LayerConstraints.AddUpDownVerticalConstraint(graph.FindNode("4"), graph.FindNode("5"));
            StraightenEdge(e, graph);
            e                  = graph.AddEdge("4", "6");
            e.LabelText        = "Changing label";
            this.labelToChange = e.Label;
            e                  = graph.AddEdge("7", "8");
            e.Attr.LineWidth  *= 2;
            e.Attr.Color       = Color.Red;
            StraightenEdge(e, graph);
            graph.AddEdge("7", "9");
            e                 = graph.AddEdge("5", "7");
            e.Attr.Color      = Color.Red;
            e.Attr.LineWidth *= 2;
            StraightenEdge(e, graph);

            graph.AddEdge("2", "7");
            graph.AddEdge("10", "11");
            graph.AddEdge("10", "12");
            graph.AddEdge("2", "10");
            graph.AddEdge("8", "10");
            graph.AddEdge("5", "10");
            graph.AddEdge("13", "14");
            graph.AddEdge("13", "15");
            graph.AddEdge("8", "13");
            graph.AddEdge("2", "13");
            graph.AddEdge("5", "13");
            graph.AddEdge("16", "17");
            graph.AddEdge("16", "18");
            graph.AddEdge("19", "20");
            graph.AddEdge("19", "21");
            graph.AddEdge("17", "19");
            graph.AddEdge("2", "19");
            graph.AddEdge("22", "23");

            e                 = graph.AddEdge("22", "24");
            e.Attr.Color      = Color.Red;
            e.Attr.LineWidth *= 2;
            StraightenEdge(e, graph);

            e                 = graph.AddEdge("8", "22");
            e.Attr.Color      = Color.Red;
            e.Attr.LineWidth *= 2;
            StraightenEdge(e, graph);
            graph.AddEdge("20", "22");
            graph.AddEdge("25", "26");
            graph.AddEdge("25", "27");
            graph.AddEdge("20", "25");
            graph.AddEdge("28", "29");
            graph.AddEdge("28", "30");
            graph.AddEdge("31", "32");
            graph.AddEdge("31", "33");
            graph.AddEdge("5", "31");
            graph.AddEdge("8", "31");
            graph.AddEdge("2", "31");
            graph.AddEdge("20", "31");
            graph.AddEdge("17", "31");
            graph.AddEdge("29", "31");
            graph.AddEdge("34", "35");
            graph.AddEdge("34", "36");
            graph.AddEdge("20", "34");
            graph.AddEdge("29", "34");
            graph.AddEdge("5", "34");
            graph.AddEdge("2", "34");
            graph.AddEdge("8", "34");
            graph.AddEdge("17", "34");
            graph.AddEdge("37", "38");
            graph.AddEdge("37", "39");
            graph.AddEdge("29", "37");
            graph.AddEdge("5", "37");
            graph.AddEdge("20", "37");
            graph.AddEdge("8", "37");
            graph.AddEdge("2", "37");
            graph.AddEdge("40", "41");
            graph.AddEdge("40", "42");
            graph.AddEdge("17", "40");
            graph.AddEdge("2", "40");
            graph.AddEdge("8", "40");
            graph.AddEdge("5", "40");
            graph.AddEdge("20", "40");
            graph.AddEdge("29", "40");
            graph.AddEdge("43", "44");
            graph.AddEdge("43", "45");
            graph.AddEdge("8", "43");
            graph.AddEdge("2", "43");
            graph.AddEdge("20", "43");
            graph.AddEdge("17", "43");
            graph.AddEdge("5", "43");
            graph.AddEdge("29", "43");
            graph.AddEdge("46", "47");
            graph.AddEdge("46", "48");
            graph.AddEdge("29", "46");
            graph.AddEdge("5", "46");
            graph.AddEdge("17", "46");
            graph.AddEdge("49", "50");
            graph.AddEdge("49", "51");
            graph.AddEdge("5", "49");
            graph.AddEdge("2", "49");
            graph.AddEdge("52", "53");
            graph.AddEdge("52", "54");
            graph.AddEdge("17", "52");
            graph.AddEdge("20", "52");
            graph.AddEdge("2", "52");
            graph.AddEdge("50", "52");
            graph.AddEdge("55", "56");
            graph.AddEdge("55", "57");
            graph.AddEdge("58", "59");
            graph.AddEdge("58", "60");
            graph.AddEdge("20", "58");
            graph.AddEdge("29", "58");
            graph.AddEdge("5", "58");
            graph.AddEdge("47", "58");

            //ChangeNodeSizes(graph);

            //var sls = graph.LayoutAlgorithmSettings as SugiyamaLayoutSettings;
            //if (sls != null)
            //{
            //    sls.GridSizeByX = 30;
            //    // sls.GridSizeByY = 0;
            //}
            //layout the graph and draw it
            gViewer.Graph = graph;
            this.propertyGrid1.SelectedObject = graph;
        }
        public void RoutingWithThreeGroups()
        {
            var graph = LoadGraph("abstract.msagl.geom");
            var root  = graph.RootCluster;
            var a     = new Cluster {
                UserData = "a"
            };

            foreach (string id in new[] { "17", "39", "13", "19", "28", "12" })
            {
                a.AddChild(graph.FindNodeByUserData(id));
            }

            var b = new Cluster {
                UserData = "b"
            };

            b.AddChild(a);
            b.AddChild(graph.FindNodeByUserData("18"));
            root.AddChild(b);

            var c = new Cluster {
                UserData = "c"
            };

            foreach (string id in new[] { "30", "5", "6", "7", "8" })
            {
                c.AddChild(graph.FindNodeByUserData(id));
            }
            root.AddChild(c);

            var clusterNodes = new Set <Node>(root.AllClustersDepthFirst().SelectMany(cl => cl.Nodes));

            foreach (var node in graph.Nodes.Where(n => clusterNodes.Contains(n) == false))
            {
                root.AddChild(node);
            }

            FixClusterBoundariesWithNoRectBoundaries(root, 5);
            var defaultSettings = new FastIncrementalLayoutSettings();
            var rootSettings    = new FastIncrementalLayoutSettings()
            {
                AvoidOverlaps = true
            };

            var initialLayout = new InitialLayoutByCluster(graph, new[] { graph.RootCluster }, cl => cl == root ? rootSettings : defaultSettings);

            initialLayout.Run();

            const double Padding = 5;

            SplineRouter splineRouter = new SplineRouter(graph, Padding / 3, Padding, Math.PI / 6);

            splineRouter.Run();
#if TEST_MSAGL
            if (!DontShowTheDebugViewer())
            {
                graph.UpdateBoundingBox();
                DisplayGeometryGraph.ShowGraph(graph);
            }
#endif
        }
Esempio n. 28
0
        void CreateGraph()
        {
#if DEBUG
            DisplayGeometryGraph.SetShowFunctions();
#endif
            Graph graph = new Graph();
            graph.AddEdge("47", "58");
            graph.AddEdge("70", "71");



            var subgraph = new Subgraph("subgraph1");
            graph.RootSubgraph.AddSubgraph(subgraph);
            subgraph.AddNode(graph.FindNode("47"));
            subgraph.AddNode(graph.FindNode("58"));

            var subgraph2 = new Subgraph("subgraph2");
            subgraph2.Attr.Color     = Color.Black;
            subgraph2.Attr.FillColor = Color.Yellow;
            subgraph2.AddNode(graph.FindNode("70"));
            subgraph2.AddNode(graph.FindNode("71"));
            subgraph.AddSubgraph(subgraph2);
            graph.AddEdge("58", subgraph2.Id);
            graph.Attr.LayerDirection = LayerDirection.LR;
            gViewer.Graph             = graph;
//            Graph graph = new Graph("graph");
//            //graph.LayoutAlgorithmSettings=new MdsLayoutSettings();
//            gViewer.BackColor = System.Drawing.Color.FromArgb(10, System.Drawing.Color.Red);
//
//            /*
//              4->5
//5->7
//7->8
//8->22
//22->24
//*/
//
//            //int wm = 80;
//            graph.AddEdge("1", "2");
//            graph.AddEdge("1", "3");
//            var e = graph.AddEdge("4", "5");
//            //e.Attr.Weight *= wm;
//            e.Attr.Color = Color.Red;
//            e.Attr.LineWidth *= 2;
//
//            e = graph.AddEdge("4", "6");
//            e.LabelText = "Changing label";
//            this.labelToChange = e.Label;
//            e=graph.AddEdge("7", "8");
//            //e.Attr.Weight *= wm;
//            e.Attr.LineWidth *= 2;
//            e.Attr.Color = Color.Red;
//
//            graph.AddEdge("7", "9");
//            e=graph.AddEdge("5", "7");
//            //e.Attr.Weight *= wm;
//            e.Attr.Color = Color.Red;
//            e.Attr.LineWidth *= 2;
//
//            graph.AddEdge("2", "7");
//            graph.AddEdge("10", "11");
//            graph.AddEdge("10", "12");
//            graph.AddEdge("2", "10");
//            graph.AddEdge("8", "10");
//            graph.AddEdge("5", "10");
//            graph.AddEdge("13", "14");
//            graph.AddEdge("13", "15");
//            graph.AddEdge("8", "13");
//            graph.AddEdge("2", "13");
//            graph.AddEdge("5", "13");
//            graph.AddEdge("16", "17");
//            graph.AddEdge("16", "18");
//            graph.AddEdge("19", "20");
//            graph.AddEdge("19", "21");
//            graph.AddEdge("17", "19");
//            graph.AddEdge("2", "19");
//            graph.AddEdge("22", "23");
//
//            e=graph.AddEdge("22", "24");
//            //e.Attr.Weight *= wm;
//            e.Attr.Color = Color.Red;
//            e.Attr.LineWidth *= 2;
//
//            e = graph.AddEdge("8", "22");
//            //e.Attr.Weight *= wm;
//            e.Attr.Color = Color.Red;
//            e.Attr.LineWidth *= 2;
//
//            graph.AddEdge("20", "22");
//            graph.AddEdge("25", "26");
//            graph.AddEdge("25", "27");
//            graph.AddEdge("20", "25");
//            graph.AddEdge("28", "29");
//            graph.AddEdge("28", "30");
//            graph.AddEdge("31", "32");
//            graph.AddEdge("31", "33");
//            graph.AddEdge("5", "31");
//            graph.AddEdge("8", "31");
//            graph.AddEdge("2", "31");
//            graph.AddEdge("20", "31");
//            graph.AddEdge("17", "31");
//            graph.AddEdge("29", "31");
//            graph.AddEdge("34", "35");
//            graph.AddEdge("34", "36");
//            graph.AddEdge("20", "34");
//            graph.AddEdge("29", "34");
//            graph.AddEdge("5", "34");
//            graph.AddEdge("2", "34");
//            graph.AddEdge("8", "34");
//            graph.AddEdge("17", "34");
//            graph.AddEdge("37", "38");
//            graph.AddEdge("37", "39");
//            graph.AddEdge("29", "37");
//            graph.AddEdge("5", "37");
//            graph.AddEdge("20", "37");
//            graph.AddEdge("8", "37");
//            graph.AddEdge("2", "37");
//            graph.AddEdge("40", "41");
//            graph.AddEdge("40", "42");
//            graph.AddEdge("17", "40");
//            graph.AddEdge("2", "40");
//            graph.AddEdge("8", "40");
//            graph.AddEdge("5", "40");
//            graph.AddEdge("20", "40");
//            graph.AddEdge("29", "40");
//            graph.AddEdge("43", "44");
//            graph.AddEdge("43", "45");
//            graph.AddEdge("8", "43");
//            graph.AddEdge("2", "43");
//            graph.AddEdge("20", "43");
//            graph.AddEdge("17", "43");
//            graph.AddEdge("5", "43");
//            graph.AddEdge("29", "43");
//            graph.AddEdge("46", "47");
//            graph.AddEdge("46", "48");
//            graph.AddEdge("29", "46");
//            graph.AddEdge("5", "46");
//            graph.AddEdge("17", "46");
//            graph.AddEdge("49", "50");
//            graph.AddEdge("49", "51");
//            graph.AddEdge("5", "49");
//            graph.AddEdge("2", "49");
//            graph.AddEdge("52", "53");
//            graph.AddEdge("52", "54");
//            graph.AddEdge("17", "52");
//            graph.AddEdge("20", "52");
//            graph.AddEdge("2", "52");
//            graph.AddEdge("50", "52");
//            graph.AddEdge("55", "56");
//            graph.AddEdge("55", "57");
//            graph.AddEdge("58", "59");
//            graph.AddEdge("58", "60");
//            graph.AddEdge("20", "58");
//            graph.AddEdge("29", "58");
//            graph.AddEdge("5", "58");
//            graph.AddEdge("47", "58");
//
//            //ChangeNodeSizes(graph);
//
//            //var sls = graph.LayoutAlgorithmSettings as SugiyamaLayoutSettings;
//            //if (sls != null)
//            //{
//            //    sls.GridSizeByX = 30;
//            //    // sls.GridSizeByY = 0;
//            //}
//            var subgraph = new Subgraph("subgraph label");
//            graph.RootSubgraph.AddSubgraph(subgraph);
//            subgraph.AddNode(graph.FindNode("47"));
//            subgraph.AddNode(graph.FindNode("58"));
//            //layout the graph and draw it
//            gViewer.Graph = graph;
            this.propertyGrid1.SelectedObject = graph;
        }