protected static void SetTargetVertex_Test <TGraph>(
            [NotNull] RootedSearchAlgorithmBase <int, TGraph> algorithm)
            where TGraph : IImplicitVertexSet <int>
        {
            int targetVertexChangeCount = 0;

            algorithm.TargetVertexChanged += (sender, args) => ++ targetVertexChangeCount;

            const int vertex1 = 0;

            algorithm.SetTargetVertex(vertex1);
            Assert.AreEqual(1, targetVertexChangeCount);
            algorithm.TryGetTargetVertex(out int target);
            Assert.AreEqual(vertex1, target);

            // Not changed
            algorithm.SetTargetVertex(vertex1);
            Assert.AreEqual(1, targetVertexChangeCount);
            algorithm.TryGetTargetVertex(out target);
            Assert.AreEqual(vertex1, target);

            const int vertex2 = 1;

            algorithm.SetTargetVertex(vertex2);
            Assert.AreEqual(2, targetVertexChangeCount);
            algorithm.TryGetTargetVertex(out target);
            Assert.AreEqual(vertex2, target);

            algorithm.SetTargetVertex(vertex1);
            Assert.AreEqual(3, targetVertexChangeCount);
            algorithm.TryGetTargetVertex(out target);
            Assert.AreEqual(vertex1, target);
        }
        protected static void TryGetTargetVertex_Test <TVertex, TGraph>(
            [NotNull] RootedSearchAlgorithmBase <TVertex, TGraph> algorithm)
            where TVertex : new()
            where TGraph : IImplicitVertexSet <TVertex>
        {
            Assert.IsFalse(algorithm.TryGetTargetVertex(out _));

            var vertex = new TVertex();

            algorithm.SetTargetVertex(vertex);
            Assert.IsTrue(algorithm.TryGetTargetVertex(out TVertex target));
            AssertEqual(vertex, target);
        }