Example #1
0
        public void QuickFind_TinyFile_True()
        {
            var dots = new Dots(@"DataStore\tinyUF.txt");
            var weightedQuickUnion = new WeightedQuickUnion(dots.Count);

            foreach (Tuple <int, int> item in dots.Items)
            {
                if (weightedQuickUnion.Connected(item.Item1, item.Item2))
                {
                    continue;
                }
                weightedQuickUnion.Union(item.Item1, item.Item2);
            }
            Assert.Equal(2, weightedQuickUnion.Count);
        }
Example #2
0
        public void QuickFind_TinyFile_True()
        {
            var dots = new Dots(@"DataStore\tinyUF.txt");
            var quickFind = new QuickFind(dots.Count);

            foreach (Tuple<int, int> item in dots.Items)
            {
                if (quickFind.Connected(item.Item1, item.Item2))
                {
                    continue;
                }
                quickFind.Union(item.Item1, item.Item2);
            }
            Assert.Equal(2, quickFind.Count);
        }