예제 #1
0
        public void PathFindingTest()
        {
            String molecule = "АГЦЦГГУААЦЦ";

            String[] fragmentsArray     = { "АГЦЦ", "ЦГГУ", "ГГУАА", "УААЦЦ" };
            DNAGraph graph              = new DNAGraph(molecule, fragmentsArray);
            List <List <String> > paths = graph.GetPaths();

            List <String> path1 = new List <String>()
            {
                "АГЦЦ", "ЦГГУ", "ГГУАА", "УААЦЦ"
            };
            List <String> path2 = new List <String>()
            {
                "АГЦЦ", "ЦГГУ", "УААЦЦ"
            };
            List <String> path3 = new List <String>()
            {
                "АГЦЦ", "ГГУАА", "УААЦЦ"
            };

            Assert.IsTrue(path1.SequenceEqual(paths[0]));
            Assert.IsTrue(path2.SequenceEqual(paths[1]));
            Assert.IsTrue(path3.SequenceEqual(paths[2]));
        }
예제 #2
0
        public void FoundPathsCountTest()
        {
            String molecule = "АГЦЦГГУААЦЦ";

            String[] fragmentsArray     = { "АГЦЦ", "ЦГГУ", "ГГУАА", "УААЦЦ" };
            DNAGraph graph              = new DNAGraph(molecule, fragmentsArray);
            List <List <String> > paths = graph.GetPaths();

            Assert.AreEqual(3, paths.Count);
        }
        private void FindPathsButton_Click(object sender, RoutedEventArgs e)
        {
            var paths = dnaGraph.GetPaths();

            if (paths.Count != 0)
            {
                foreach (var path in paths)
                {
                    String pathOutput = String.Empty;
                    foreach (var node in path)
                    {
                        pathOutput += node + " -> ";
                    }
                    pathOutput = pathOutput.Remove(pathOutput.Length - 4);

                    OutputPathsListBox.Items.Add(pathOutput);
                }
            }
            else
            {
                OutputPathsListBox.Items.Add("По полученным фрагментам невозможно составить молекулу");
            }
        }