Example #1
0
        public void AddRepeatArcOr()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(true, 3);

            graph.AddArc(0, 1);
            graph.AddArc(0, 1);
        }
Example #2
0
        public void InArcsCountOr()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(true, 4);

            graph.AddArc(0, 1);
            graph.AddArc(0, 2);
            graph.AddArc(1, 2);
            graph.AddArc(1, 3);

            Assert.AreEqual(0, graph.InArcsCount(0));
            Assert.AreEqual(1, graph.InArcsCount(1));
            Assert.AreEqual(2, graph.InArcsCount(2));
            Assert.AreEqual(1, graph.InArcsCount(3));

            graph.DeleteArc(1, 2);

            Assert.AreEqual(0, graph.InArcsCount(0));
            Assert.AreEqual(1, graph.InArcsCount(1));
            Assert.AreEqual(1, graph.InArcsCount(2));
            Assert.AreEqual(1, graph.InArcsCount(3));

            graph.DeleteArc(0, 1);

            Assert.AreEqual(0, graph.InArcsCount(0));
            Assert.AreEqual(0, graph.InArcsCount(1));
            Assert.AreEqual(1, graph.InArcsCount(2));
            Assert.AreEqual(1, graph.InArcsCount(3));
        }
Example #3
0
        public void AddRepeatArcReverseEx()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(false, 2);

            graph.AddArc(0, 1);
            graph.AddArc(1, 0);
        }
Example #4
0
        public void AddArcTwoDirOr()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(true, 2);

            graph.AddArc(0, 1);
            graph.AddArc(1, 0);

            Assert.IsTrue(graph.ContainsArc(0, 1));
            Assert.IsTrue(graph.ContainsArc(1, 0));
        }
Example #5
0
        public void PeakCountAfterDelOr()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(true, 3);

            graph.AddArc(0, 1);
            graph.AddArc(1, 2);
            graph.AddArc(2, 0);

            Assert.AreEqual(3, graph.PeakCount);
            graph.RemovePeak(2);
            Assert.AreEqual(2, graph.PeakCount);
        }
Example #6
0
        public void PeakCountAfterAdd()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(false, 3);

            graph.AddArc(0, 1);
            graph.AddArc(1, 2);
            graph.AddArc(2, 0);

            Assert.AreEqual(3, graph.PeakCount);
            graph.AddPeak();
            Assert.AreEqual(4, graph.PeakCount);
        }
Example #7
0
        public void MatrixFiveModern()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(true, 5);

            Dictionary <char, int> peakCodes = new Dictionary <char, int>
            {
                ['a'] = 0,
                ['b'] = 1,
                ['c'] = 2,
                ['d'] = 3,
                ['e'] = 4
            };

            graph.AddArc(peakCodes['a'], peakCodes['b']);
            graph.AddArc(peakCodes['b'], peakCodes['c']);
            graph.AddArc(peakCodes['c'], peakCodes['d']);
            graph.AddArc(peakCodes['d'], peakCodes['e']);
            graph.AddArc(peakCodes['e'], peakCodes['a']);

            graph.RemovePeak(peakCodes['c']);
            peakCodes.Remove('c');
            peakCodes['d'] = 2;
            peakCodes['e'] = 3;

            Assert.AreEqual(4, graph.PeakCount);
            Assert.IsTrue(graph.ContainsArc(peakCodes['a'], peakCodes['b']));
            Assert.IsTrue(graph.ContainsArc(peakCodes['d'], peakCodes['e']));
            Assert.IsTrue(graph.ContainsArc(peakCodes['e'], peakCodes['a']));
            Assert.IsFalse(graph.ContainsArc(peakCodes['a'], peakCodes['d']));
            Assert.IsFalse(graph.ContainsArc(peakCodes['b'], peakCodes['d']));

            Assert.IsFalse(graph.ContainsArc(peakCodes['b'], peakCodes['a']));
            Assert.IsFalse(graph.ContainsArc(peakCodes['e'], peakCodes['d']));
            Assert.IsFalse(graph.ContainsArc(peakCodes['a'], peakCodes['e']));
            Assert.IsFalse(graph.ContainsArc(peakCodes['d'], peakCodes['a']));
            Assert.IsFalse(graph.ContainsArc(peakCodes['d'], peakCodes['b']));

            Assert.IsFalse(graph.ContainsArc(peakCodes['b'], peakCodes['e']));
            Assert.IsFalse(graph.ContainsArc(peakCodes['e'], peakCodes['b']));

            graph.RemovePeak(peakCodes['e']); // слетает Oriented // присваиваются не битовые матрицы
            peakCodes.Remove('e');

            Assert.AreEqual(3, graph.PeakCount);
            Assert.IsTrue(graph.ContainsArc(peakCodes['a'], peakCodes['b']));
            Assert.IsFalse(graph.ContainsArc(peakCodes['a'], peakCodes['d']));
            Assert.IsFalse(graph.ContainsArc(peakCodes['b'], peakCodes['d']));

            Assert.IsFalse(graph.ContainsArc(peakCodes['b'], peakCodes['a'])); // ??? - ошибка
            Assert.IsFalse(graph.ContainsArc(peakCodes['d'], peakCodes['a']));
            Assert.IsFalse(graph.ContainsArc(peakCodes['d'], peakCodes['b']));
        }
Example #8
0
        public void DeleteArcOr()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(true, 4);

            graph.AddArc(0, 1);
            graph.AddArc(0, 2);
            graph.AddArc(1, 2);
            graph.AddArc(1, 3);

            Assert.IsTrue(graph.ContainsArc(0, 1));
            Assert.IsFalse(graph.ContainsArc(1, 0));
            Assert.IsTrue(graph.ContainsArc(0, 2));
            Assert.IsFalse(graph.ContainsArc(2, 0));
            Assert.IsTrue(graph.ContainsArc(1, 2));
            Assert.IsFalse(graph.ContainsArc(2, 1));
            Assert.IsTrue(graph.ContainsArc(1, 3));
            Assert.IsFalse(graph.ContainsArc(3, 1));
            Assert.IsFalse(graph.ContainsArc(0, 3));
            Assert.IsFalse(graph.ContainsArc(3, 0));
            Assert.IsFalse(graph.ContainsArc(2, 3));
            Assert.IsFalse(graph.ContainsArc(3, 2));

            graph.DeleteArc(1, 2);

            Assert.IsTrue(graph.ContainsArc(0, 1));
            Assert.IsFalse(graph.ContainsArc(1, 0));
            Assert.IsTrue(graph.ContainsArc(0, 2));
            Assert.IsFalse(graph.ContainsArc(2, 0));
            Assert.IsFalse(graph.ContainsArc(1, 2));
            Assert.IsFalse(graph.ContainsArc(2, 1));
            Assert.IsTrue(graph.ContainsArc(1, 3));
            Assert.IsFalse(graph.ContainsArc(3, 1));
            Assert.IsFalse(graph.ContainsArc(0, 3));
            Assert.IsFalse(graph.ContainsArc(3, 0));
            Assert.IsFalse(graph.ContainsArc(2, 3));
            Assert.IsFalse(graph.ContainsArc(3, 2));

            graph.DeleteArc(0, 1);

            Assert.IsFalse(graph.ContainsArc(0, 1));
            Assert.IsFalse(graph.ContainsArc(1, 0));
            Assert.IsTrue(graph.ContainsArc(0, 2));
            Assert.IsFalse(graph.ContainsArc(2, 0));
            Assert.IsFalse(graph.ContainsArc(1, 2));
            Assert.IsFalse(graph.ContainsArc(2, 1));
            Assert.IsTrue(graph.ContainsArc(1, 3));
            Assert.IsFalse(graph.ContainsArc(3, 1));
            Assert.IsFalse(graph.ContainsArc(0, 3));
            Assert.IsFalse(graph.ContainsArc(3, 0));
            Assert.IsFalse(graph.ContainsArc(2, 3));
            Assert.IsFalse(graph.ContainsArc(3, 2));
        }
Example #9
0
        public void ThreeElFromMiddleIncorrect()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(false, 3);

            graph.AddArc(0, 1);
            graph.AddArc(1, 2);
            graph.AddArc(2, 0);

            graph.RemovePeak(1);

            Assert.IsTrue(graph.ContainsArc(2, 0));
            Assert.IsTrue(graph.ContainsArc(0, 2));
        }
Example #10
0
        public void MatrixThree()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(false, 3);

            graph.AddArc(0, 1);
            graph.AddArc(1, 2);
            graph.AddArc(2, 0);

            graph.RemovePeak(1);

            Assert.AreEqual(2, graph.PeakCount);
            Assert.IsTrue(graph.ContainsArc(1, 0));
            Assert.IsTrue(graph.ContainsArc(0, 1));
        }
Example #11
0
        public void DeleteArcIncorrect()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(false, 3);

            graph.AddArc(0, 1);
            graph.DeleteArc(1, 2);
        }
Example #12
0
        public void DeleteArcIncorrectOrInverse()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(true, 2);

            graph.AddArc(0, 1);
            Assert.IsTrue(graph.ContainsArc(0, 1));
            Assert.IsFalse(graph.ContainsArc(1, 0));

            graph.DeleteArc(1, 0);
        }
Example #13
0
        public void InComingArcsOr()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(true, 3);

            graph.AddArc(0, 1);
            graph.AddArc(0, 2);
            graph.AddArc(1, 0);
            graph.AddArc(1, 2);
            graph.AddArc(2, 0);

            int i = 0;

            int[] zero = { 1, 2 };
            int[] one  = { 0 };
            int[] two  = { 0, 1 };

            Assert.IsTrue(graph.InComingArcs(0).Count() == zero.Length);
            foreach (var e in graph.InComingArcs(0))
            {
                Assert.IsTrue(zero[i] == e);
                i++;
            }

            i = 0;

            Assert.IsTrue(graph.InComingArcs(1).Count() == one.Length);
            foreach (var e in graph.InComingArcs(1))
            {
                Assert.IsTrue(one[i] == e);
                i++;
            }

            i = 0;

            Assert.IsTrue(graph.InComingArcs(2).Count() == two.Length);
            foreach (var e in graph.InComingArcs(2))
            {
                Assert.IsTrue(two[i] == e);
                i++;
            }
        }
Example #14
0
        public void FiveElFromMiddleCorrect()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(false, 5);

            Dictionary <char, int> peakCodes = new Dictionary <char, int>
            {
                ['a'] = 0,
                ['b'] = 1,
                ['c'] = 2,
                ['d'] = 3,
                ['e'] = 4
            };

            graph.AddArc(peakCodes['a'], peakCodes['b']);
            graph.AddArc(peakCodes['b'], peakCodes['c']);
            graph.AddArc(peakCodes['c'], peakCodes['d']);
            graph.AddArc(peakCodes['d'], peakCodes['e']);
            graph.AddArc(peakCodes['e'], peakCodes['a']);

            graph.RemovePeak(peakCodes['c']);
            peakCodes.Remove('c');
            peakCodes['d'] = 2;
            peakCodes['e'] = 3;

            Assert.AreEqual(4, graph.PeakCount);
            Assert.IsTrue(graph.ContainsArc(peakCodes['a'], peakCodes['b']));
            Assert.IsTrue(graph.ContainsArc(peakCodes['d'], peakCodes['e']));
            Assert.IsTrue(graph.ContainsArc(peakCodes['e'], peakCodes['a']));
            Assert.IsFalse(graph.ContainsArc(peakCodes['a'], peakCodes['d']));
            Assert.IsFalse(graph.ContainsArc(peakCodes['b'], peakCodes['d']));

            Assert.IsTrue(graph.ContainsArc(peakCodes['b'], peakCodes['a']));
            Assert.IsTrue(graph.ContainsArc(peakCodes['e'], peakCodes['d']));
            Assert.IsTrue(graph.ContainsArc(peakCodes['a'], peakCodes['e']));
            Assert.IsFalse(graph.ContainsArc(peakCodes['d'], peakCodes['a']));
            Assert.IsFalse(graph.ContainsArc(peakCodes['d'], peakCodes['b']));

            Assert.IsFalse(graph.ContainsArc(peakCodes['b'], peakCodes['e']));
            Assert.IsFalse(graph.ContainsArc(peakCodes['e'], peakCodes['b']));
        }
Example #15
0
        public void InArcsCountDelPeak()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(false, 3);

            graph.AddArc(0, 1);

            Assert.AreEqual(1, graph.InArcsCount(0));
            Assert.AreEqual(1, graph.InArcsCount(1));
            Assert.AreEqual(0, graph.InArcsCount(2));

            graph.AddArc(1, 2);
            graph.AddArc(0, 2);

            Assert.AreEqual(2, graph.InArcsCount(0));
            Assert.AreEqual(2, graph.InArcsCount(1));
            Assert.AreEqual(2, graph.InArcsCount(2));

            graph.RemovePeak(1);

            Assert.AreEqual(1, graph.InArcsCount(1));
            Assert.AreEqual(1, graph.InArcsCount(0));
        }
Example #16
0
        public void InComingArcsOrEmptyPeak()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(true, 3);

            graph.AddArc(0, 1);

            Assert.IsTrue(graph.InComingArcs(2).Count() == 0);
            foreach (var e in graph.InComingArcs(2))
            {
                Assert.AreEqual(0, graph.InComingArcs(2));
                Assert.AreEqual(0, e);
            }
        }
Example #17
0
        public void AddArc()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(false, 3);

            graph.AddArc(0, 1);
            graph.AddArc(2, 1);

            Assert.IsTrue(graph.ContainsArc(0, 1));
            Assert.IsTrue(graph.ContainsArc(1, 0));
            Assert.IsTrue(graph.ContainsArc(1, 2));
            Assert.IsTrue(graph.ContainsArc(2, 1));
            Assert.IsFalse(graph.ContainsArc(0, 2));
            Assert.IsFalse(graph.ContainsArc(2, 0));

            graph.AddArc(2, 0);

            Assert.IsTrue(graph.ContainsArc(0, 1));
            Assert.IsTrue(graph.ContainsArc(1, 0));
            Assert.IsTrue(graph.ContainsArc(1, 2));
            Assert.IsTrue(graph.ContainsArc(2, 1));
            Assert.IsTrue(graph.ContainsArc(0, 2));
            Assert.IsTrue(graph.ContainsArc(2, 0));
        }
Example #18
0
        public void CycleSix()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(true, 6);

            graph.AddArc(0, 3);
            graph.AddArc(0, 2);

            graph.AddArc(1, 3);

            graph.AddArc(3, 4);
            graph.AddArc(3, 5);

            graph.AddArc(4, 1);

            graph.AddArc(5, 1);

            Kahn.Run(graph);
        }
Example #19
0
        public void FivePeaks()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(true, 5);

            graph.AddArc(0, 1);
            graph.AddArc(0, 2);
            graph.AddArc(0, 3);
            graph.AddArc(0, 4);

            graph.AddArc(1, 3);

            graph.AddArc(2, 3);
            graph.AddArc(2, 4);

            graph.AddArc(3, 4);

            Assert.AreEqual(0, Kahn.Run(graph)[0]);
            Assert.AreEqual(1, Kahn.Run(graph)[1]);
            Assert.AreEqual(2, Kahn.Run(graph)[2]);
            Assert.AreEqual(3, Kahn.Run(graph)[3]);
            Assert.AreEqual(4, Kahn.Run(graph)[4]);
        }
Example #20
0
        public void KahnDifference()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(true, 6);

            graph.AddArc(0, 1);
            graph.AddArc(0, 2);

            graph.AddArc(1, 2);

            graph.AddArc(3, 1);

            graph.AddArc(4, 2);
            graph.AddArc(4, 1);

            Assert.AreEqual(0, Tarjan.Run(graph)[0]);
            Assert.AreEqual(3, Tarjan.Run(graph)[1]);
            Assert.AreEqual(4, Tarjan.Run(graph)[2]);
            Assert.AreEqual(1, Tarjan.Run(graph)[3]);
            Assert.AreEqual(2, Tarjan.Run(graph)[4]);
        }
Example #21
0
        public void FivePeaksSeveralScatter()
        {
            // как разобрался, не увидел сложности в таких тестрах, на каждом уровне вершины просто в порядке возрастания
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(true, 5);

            graph.AddArc(0, 1);
            graph.AddArc(0, 2);

            graph.AddArc(1, 2);

            graph.AddArc(3, 1);

            graph.AddArc(4, 2);
            graph.AddArc(4, 1);

            Assert.AreEqual(0, Kahn.Run(graph)[0]);
            Assert.AreEqual(3, Kahn.Run(graph)[1]);
            Assert.AreEqual(4, Kahn.Run(graph)[2]);
            Assert.AreEqual(1, Kahn.Run(graph)[3]);
            Assert.AreEqual(2, Kahn.Run(graph)[4]);
        }
Example #22
0
        public void AddArcNotExistPeakOr()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(true, 3);

            graph.AddArc(4, 1);
        }
Example #23
0
        public void SquareMatrixSeven()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(true, 7);

            PeakCodes peakCounts = new PeakCodes()
            {
                'a', 'b', 'c', 'd', 'e', 'f', 'g'
            };

            //Необходимость сортировки
            graph.AddArc(peakCounts['g'], peakCounts['f']);
            graph.AddArc(peakCounts['g'], peakCounts['e']);

            graph.AddArc(peakCounts['a'], peakCounts['b']);
            graph.AddArc(peakCounts['b'], peakCounts['c']);
            graph.AddArc(peakCounts['c'], peakCounts['b']);

            graph.AddArc(peakCounts['a'], peakCounts['d']);
            graph.AddArc(peakCounts['d'], peakCounts['b']);
            graph.AddArc(peakCounts['c'], peakCounts['d']);
            graph.AddArc(peakCounts['d'], peakCounts['c']);

            graph.AddArc(peakCounts['e'], peakCounts['f']);
            graph.AddArc(peakCounts['f'], peakCounts['e']);

            graph.AddArc(peakCounts['e'], peakCounts['d']);
            graph.AddArc(peakCounts['d'], peakCounts['e']);
            graph.AddArc(peakCounts['d'], peakCounts['f']);
            graph.AddArc(peakCounts['g'], peakCounts['d']);

            graph.AddArc(peakCounts['a'], peakCounts['e']);
            graph.AddArc(peakCounts['f'], peakCounts['b']);
            graph.AddArc(peakCounts['c'], peakCounts['g']);
            graph.AddArc(peakCounts['g'], peakCounts['c']);

            graph.RemovePeak(peakCounts['d']);
            peakCounts.Remove('d');

            Assert.IsTrue(graph.ContainsArc(peakCounts['a'], peakCounts['b']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['a'], peakCounts['c']));
            Assert.IsTrue(graph.ContainsArc(peakCounts['a'], peakCounts['e']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['a'], peakCounts['f']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['a'], peakCounts['g']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['b'], peakCounts['a']));
            Assert.IsTrue(graph.ContainsArc(peakCounts['b'], peakCounts['c']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['b'], peakCounts['e']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['b'], peakCounts['f']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['b'], peakCounts['g']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['c'], peakCounts['a']));
            Assert.IsTrue(graph.ContainsArc(peakCounts['c'], peakCounts['b']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['c'], peakCounts['e']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['c'], peakCounts['f']));
            Assert.IsTrue(graph.ContainsArc(peakCounts['c'], peakCounts['g']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['e'], peakCounts['a']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['e'], peakCounts['c']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['e'], peakCounts['b']));
            Assert.IsTrue(graph.ContainsArc(peakCounts['e'], peakCounts['f']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['e'], peakCounts['g']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['f'], peakCounts['a']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['f'], peakCounts['c']));
            Assert.IsTrue(graph.ContainsArc(peakCounts['f'], peakCounts['e']));
            Assert.IsTrue(graph.ContainsArc(peakCounts['f'], peakCounts['b']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['f'], peakCounts['g']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['g'], peakCounts['a']));
            Assert.IsTrue(graph.ContainsArc(peakCounts['g'], peakCounts['c']));
            Assert.IsTrue(graph.ContainsArc(peakCounts['g'], peakCounts['e']));
            Assert.IsTrue(graph.ContainsArc(peakCounts['g'], peakCounts['f']));
            Assert.IsFalse(graph.ContainsArc(peakCounts['g'], peakCounts['b']));
        }
Example #24
0
        public void Combine()
        {
            UnweightedGraphMatrix graph = new UnweightedGraphMatrix(false, 2);

            Assert.IsFalse(graph.Oriented);
            Assert.AreEqual(2, graph.PeakCount);

            // AddArc ==================

            graph.AddArc(0, 1);

            Assert.IsTrue(graph.ContainsArc(0, 1));
            Assert.IsTrue(graph.ContainsArc(1, 0));

            Assert.AreEqual(1, graph.InArcsCount(0));
            Assert.AreEqual(1, graph.InArcsCount(1));

            Assert.IsTrue(graph.OutGoingArcs(0).Count() == 1);
            foreach (var e in graph.OutGoingArcs(0))
            {
                Assert.AreEqual(1, e);
            }

            Assert.IsTrue(graph.OutGoingArcs(1).Count() == 1);
            foreach (var e in graph.OutGoingArcs(1))
            {
                Assert.AreEqual(0, e);
            }

            Assert.IsTrue(graph.InComingArcs(0).Count() == 1);
            foreach (var e in graph.InComingArcs(0))
            {
                Assert.AreEqual(1, e);
            }

            Assert.IsTrue(graph.InComingArcs(1).Count() == 1);
            foreach (var e in graph.InComingArcs(1))
            {
                Assert.AreEqual(0, e);
            }

            // AddPeak ==================

            graph.AddPeak();
            Assert.AreEqual(3, graph.PeakCount);

            graph.AddArc(0, 2);
            Assert.IsTrue(graph.ContainsArc(0, 2));
            Assert.IsTrue(graph.ContainsArc(2, 0));
            Assert.AreEqual(2, graph.InArcsCount(0));
            Assert.AreEqual(1, graph.InArcsCount(2));

            int[] zeroIn    = { 1, 2 };
            int   zeroInInd = 0;

            Assert.IsTrue(graph.InComingArcs(0).Count() == 2);
            foreach (var e in graph.InComingArcs(0))
            {
                Assert.AreEqual(zeroIn[zeroInInd], e);
                zeroInInd++;
            }

            Assert.IsTrue(graph.InComingArcs(2).Count() == 1);
            foreach (var e in graph.InComingArcs(2))
            {
                Assert.AreEqual(0, e);
            }

            int[] zeroOut    = { 1, 2 };
            int   zeroOutInd = 0;

            Assert.IsTrue(graph.OutGoingArcs(0).Count() == 2);
            foreach (var e in graph.OutGoingArcs(0))
            {
                Assert.AreEqual(zeroOut[zeroOutInd], e);
                zeroOutInd++;
            }

            Assert.IsTrue(graph.OutGoingArcs(2).Count() == 1);
            foreach (var e in graph.OutGoingArcs(2))
            {
                Assert.AreEqual(0, e);
            }

            graph.AddPeak();
            graph.AddArc(3, 2);
            graph.DeleteArc(2, 0);
            graph.RemovePeak(1);

            // Проверка ребер

            Assert.IsFalse(graph.ContainsArc(0, 1));
            Assert.IsFalse(graph.ContainsArc(1, 0));
            Assert.IsFalse(graph.ContainsArc(0, 2));
            Assert.IsFalse(graph.ContainsArc(2, 0));
            Assert.IsTrue(graph.ContainsArc(1, 2));
            Assert.IsTrue(graph.ContainsArc(2, 1));

            // Проверка вершин

            // Нулевая

            Assert.AreEqual(0, graph.InArcsCount(0));

            Assert.IsTrue(graph.OutGoingArcs(0).Count() == 0);
            foreach (var e in graph.OutGoingArcs(0))
            {
                Assert.AreEqual(0, e);
            }

            Assert.IsTrue(graph.InComingArcs(0).Count() == 0);
            foreach (var e in graph.InComingArcs(0))
            {
                Assert.AreEqual(0, e);
            }

            // Первая

            Assert.AreEqual(1, graph.InArcsCount(1));

            Assert.IsTrue(graph.OutGoingArcs(1).Count() == 1);
            foreach (var e in graph.OutGoingArcs(1))
            {
                Assert.AreEqual(2, e);
            }

            Assert.IsTrue(graph.InComingArcs(1).Count() == 1);
            foreach (var e in graph.InComingArcs(1))
            {
                Assert.AreEqual(2, e);
            }

            // Вторая

            Assert.AreEqual(1, graph.InArcsCount(2));

            Assert.IsTrue(graph.OutGoingArcs(2).Count() == 1);
            foreach (var e in graph.OutGoingArcs(2))
            {
                Assert.AreEqual(1, e);
            }

            Assert.IsTrue(graph.InComingArcs(2).Count() == 1);
            foreach (var e in graph.InComingArcs(2))
            {
                Assert.AreEqual(1, e);
            }


            // Завершение

            Assert.IsFalse(graph.Oriented);
            Assert.AreEqual(3, graph.PeakCount);
        }