private void AdjustVertex([NotNull] TVertex closest) { Debug.Assert(closest != null); _queue.Clear(); ISOMData vid = _isomDataDict[closest]; vid.Distance = 0; vid.Visited = true; _queue.Enqueue(closest); while (_queue.Count > 0) { ThrowIfCancellationRequested(); TVertex current = _queue.Dequeue(); ISOMData currentData = _isomDataDict[current]; Point position = VerticesPositions[current]; Vector force = _tempPos - position; double factor = _adaptation / Math.Pow(2, currentData.Distance); position += factor * force; VerticesPositions[current] = position; // If it is in the radius if (currentData.Distance < _radius) { // Also consider neighbors foreach (TVertex neighbor in VisitedGraph.GetNeighbors(current)) { ThrowIfCancellationRequested(); ISOMData neighborData = _isomDataDict[neighbor]; if (!neighborData.Visited) { neighborData.Visited = true; neighborData.Distance = currentData.Distance + 1; _queue.Enqueue(neighbor); } } } } }