protected override void InternalCompute() { if (this.VisitedGraph.VertexCount == 0) { return; } TVertex rootVertex; IEnumerable <TVertex> roots; if (this.TryGetRootVertex(out rootVertex)) { roots = new TVertex[] { rootVertex } } ; else { roots = AlgorithmExtensions.Roots(this.VisitedGraph); } VisitRoots(roots); }
protected override void InternalCompute() { if (this.VisitedGraph.VertexCount == 0) { return; } TVertex rootVertex; if (!this.TryGetRootVertex(out rootVertex)) { // enqueue roots foreach (var root in AlgorithmExtensions.Roots(this.VisitedGraph)) { this.EnqueueRoot(root); } } else // enqueue select root only { this.EnqueueRoot(rootVertex); } this.FlushVisitQueue(); }