Ejemplo n.º 1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var a = new Graph <Vertex, Weight>(true, false);
            var b = new Graph <Vertex, Weight>(true, false);

            a.AddVertex(new Vertex("0"));
            a.AddVertex(new Vertex("1"));
            a.AddVertex(new Vertex("2"));
            a.AddEdge(new Vertex("1"), new Vertex("0"));
            a.AddEdge(new Vertex("1"), new Vertex("2"));
            b.AddVertex(new Vertex("1"));
            b.AddVertex(new Vertex("2"));
            b.AddVertex(new Vertex("3"));
            b.AddEdge(new Vertex("1"), new Vertex("2"));
            b.AddEdge(new Vertex("2"), new Vertex("1"));
            b.AddEdge(new Vertex("1"), new Vertex("3"));
            a.Union(b);

            var GUI   = new MainForm();
            var field = new ModelsField <Vertex, Weight>(GUI);

            GUI.AttachField(field);


            CommandRepository.AddCommand(nameof(HalfLifeDegreeCommand), new HalfLifeDegreeCommand(field));

            CommandRepository.AddCommand("SaveGraphToFileCommand", new SaveGraphToFileCommand(field));
            CommandRepository.AddCommand(nameof(OpenGraphInFileCommand), new OpenGraphInFileCommand(field));

            CommandRepository.AddCommand(nameof(AddModelCommand), new AddModelCommand(field));
            CommandRepository.AddCommand(nameof(CreateGraphCommand), new CreateGraphCommand(field));
            CommandRepository.AddCommand(nameof(MoveVertexModelCommand), new MoveVertexModelCommand(field));
            CommandRepository.AddCommand(nameof(RemoveModelsCommand), new RemoveModelsCommand(field));
            CommandRepository.AddCommand(nameof(RemoveGraphCommand), new RemoveGraphCommand(field));

            CommandRepository.AddCommand("DFSalgorithm", new DFSalgorithmCommand <Vertex, Weight>(field));
            CommandRepository.AddCommand("ShortcutBFSalgorithm", new ShortcutBFSalgorithmCommand <Vertex, Weight>(field));

            _ = new CommandDispetcher(GUI);
            Application.Run(GUI);
        }
Ejemplo n.º 2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var GUI   = new MainForm();
            var field = new ModelsField <Vertex>(GUI);

            GUI.AttachField(field);

            CommandRepository.AddCommand(nameof(HalfLifeDegreeCommand), new HalfLifeDegreeCommand(field));
            CommandRepository.AddCommand(nameof(AddCurrentGraphInStoredGraphsCommand), new AddCurrentGraphInStoredGraphsCommand(field));
            CommandRepository.AddCommand(nameof(GraphsUnionCommand), new GraphsUnionCommand(field));
            CommandRepository.AddCommand(nameof(RemoveStoredGraphCommand), new RemoveStoredGraphCommand(field));
            CommandRepository.AddCommand(nameof(SaveGraphToFileCommand), new SaveGraphToFileCommand(field));
            CommandRepository.AddCommand(nameof(OpenGraphInFileCommand), new OpenGraphInFileCommand(field));

            CommandRepository.AddCommand(nameof(AddModelCommand), new AddModelCommand(field));
            CommandRepository.AddCommand(nameof(CreateGraphCommand), new CreateGraphCommand(field));
            CommandRepository.AddCommand(nameof(MoveVertexModelCommand), new MoveVertexModelCommand(field));
            CommandRepository.AddCommand(nameof(RemoveModelsCommand), new RemoveModelsCommand(field));
            CommandRepository.AddCommand(nameof(RemoveGraphCommand), new RemoveGraphCommand(field));
            CommandRepository.AddCommand(nameof(SaveAlgorithmResultCommand), new SaveAlgorithmResultCommand(field));

            CommandRepository.AddCommand("DFSalgorithm", new DFSalgorithmCommand <Vertex>(field));
            CommandRepository.AddCommand("ShortcutBFSalgorithm", new ShortcutBFSalgorithmCommand <Vertex>(field));
            CommandRepository.AddCommand("ConnectedComponentsCommand", new ConnectedComponentsCommand <Vertex>(field));
            CommandRepository.AddCommand("MSTCommand", new MSTCommand <Vertex>(field));
            CommandRepository.AddCommand("DijkstraAlgorithm", new DijkstraAlgorithm <Vertex>(field));
            CommandRepository.AddCommand("WayNoMoreThenLCommand", new WayNoMoreThenLCommand <Vertex>(field));
            CommandRepository.AddCommand("EdmondsKarpAlgorithm", new EdmondsKarpAlgorithm <Vertex>(field));
            CommandRepository.AddCommand("NPeripheryCommand", new NPeripheryCommand <Vertex>(field));

            _ = new CommandDispetcher(GUI);
            Application.Run(GUI);
        }