Exemplo n.º 1
0
        public void GenerateGraph()
        {
            var generatorDialog = new GraphGeneratorViewModel(Document.ObservableVertices.Count);
            var res             = WindowManager.ShowDialog(generatorDialog);

            if (res.HasValue && res.Value)
            {
                var generator = new GraphGenerator();
                var edgesList = generator.GenerateEdgesList(generatorDialog.Dense, generatorDialog.VerticesCount);
                if (CheckGraphForClearing())
                {
                    Init();
                    _repository.LoadFromText(Document, edgesList, GraphSourceType.EdgesList);

                    // if some vertices have not edges.
                    for (int i = 1; i <= generatorDialog.VerticesCount; i++)
                    {
                        Document.AddVertex(i);
                    }

                    EllipseVerticesPositionIfNeed();
                }
            }
        }