Exemplo n.º 1
0
        public void TryGetVertexPairs()
        {
            var graph     = new AdjacencyGraph <int, Edge <int> >();
            var algorithm = new TarjanOfflineLeastCommonAncestorAlgorithm <int, Edge <int> >(graph);

            Assert.IsFalse(algorithm.TryGetVertexPairs(out _));

            graph.AddVertexRange(new[] { 1, 2 });
            algorithm.SetVertexPairs(new[] { new SEquatableEdge <int>(1, 2) });
            Assert.IsTrue(algorithm.TryGetVertexPairs(out IEnumerable <SEquatableEdge <int> > pairs));
            CollectionAssert.AreEqual(
                new[] { new SEquatableEdge <int>(1, 2) },
                pairs);
        }