public override void ResetGraph(IEnumerable <TVertex> vertices, IEnumerable <TEdge> edges)
 {
     if (VisitedGraph == null && !TryCreateNewGraph())
     {
         throw new GX_GeneralException("Can't create new graph through reflection. Make sure it support default constructor.");
     }
     VisitedGraph.Clear();
     VisitedGraph.AddVertexRange(vertices);
     VisitedGraph.AddEdgeRange(edges);
 }
        /// <inheritdoc />
        protected override void InternalCompute()
        {
            if (!TryGetRootVertex(out TVertex root))
            {
                throw new InvalidOperationException("RootVertex is not specified.");
            }

            VisitedGraph.Clear();
            _unExploredVertices.Clear();
            FinishedSuccessfully = false;

            if (!AddVertexPredicate(root))
            {
                throw new ArgumentException($"StartVertex does not satisfy the {nameof(AddVertexPredicate)}.");
            }
            OnVertexDiscovered(root);

            while (_unExploredVertices.Count > 0)
            {
                // Are we done yet?
                if (!FinishedPredicate(this))
                {
                    FinishedSuccessfully = false;
                    return;
                }

                TVertex current = _unExploredVertices.Dequeue();
                TVertex clone   = (TVertex)current.Clone();

                // Let's make sure we want to explore this one
                if (!ExploreVertexPredicate(clone))
                {
                    continue;
                }

                foreach (ITransitionFactory <TVertex, TEdge> transitionFactory in TransitionFactories)
                {
                    GenerateFromTransitionFactory(clone, transitionFactory);
                }
            }

            FinishedSuccessfully = true;
        }